Last active
July 12, 2023 12:37
-
-
Save BananaAcid/fa00ea00cf1534c729665df385c01857 to your computer and use it in GitHub Desktop.
NodeJS cli stream (pipe) to process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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