Created
November 5, 2015 00:14
-
-
Save jimmybot/70f37df7a4aa1d6887c9 to your computer and use it in GitHub Desktop.
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
"use strict"; | |
/* | |
const duplexer2 = require('duplexer2') | |
const {Readable, Writable} = require('stream') | |
*/ | |
const duplexer = require('duplexer2') | |
const child_process = require('child_process') | |
let cp = child_process.spawn('bash') | |
let dp = duplexer(cp.stdin, cp.stdout) | |
dp.on('error', function(err) { | |
console.log('had error', err) | |
}) | |
dp.on('data', function(data) { | |
console.log('data:', data.toString()) | |
}) | |
dp.write('ls -l\n') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment