Skip to content

Instantly share code, notes, and snippets.

@BananaAcid
Last active July 12, 2023 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BananaAcid/fa00ea00cf1534c729665df385c01857 to your computer and use it in GitHub Desktop.
Save BananaAcid/fa00ea00cf1534c729665df385c01857 to your computer and use it in GitHub Desktop.
NodeJS cli stream (pipe) to process
import { spawn } from 'child_process';
const child = spawn('pwsh');
process.stdin.pipe(child.stdin)
child.stdout.on('data', (data) => {
console.log(`child stdout:\n${data}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment