readable event called, but calling .read() on the stream results in an empty string.
Last active
August 29, 2015 14:26
-
-
Save bahamas10/56d99b31ccfa9105dc73 to your computer and use it in GitHub Desktop.
node 10 child_process readable
This file contains hidden or 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
| var cp = require('child_process'); | |
| var child = cp.spawn('sysevent'); | |
| child.stderr.setEncoding('utf8'); | |
| child.stderr.on('readable', function () { | |
| console.log('stderr readable'); | |
| var stderr = ''; | |
| var chunk; | |
| while ((chunk = child.stderr.read()) !== null) | |
| stderr += chunk; | |
| console.dir(stderr); | |
| console.log('---'); | |
| }); | |
| child.on('close', function () {}); |
This file contains hidden or 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
| root - build sunos ~/temp # node child_process_test.js | |
| stderr readable | |
| '' | |
| --- | |
| stderr readable | |
| 'sysevent: sysevent_bind_handle: Bad address\n' | |
| --- | |
| stderr readable | |
| '' | |
| --- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment