You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there might be a few problems going on here that might need updating. I get very different behavior depending on which commands I run:
$ cat test.js
require('shelljs/global');
exec('echo stdout is showing');
exec('echo stderr is showing >&2');
$ node test.js >/dev/null
stderr is showing
$ node test.js 2>/dev/null
stdout is showing
$ shjs test.js >/dev/null
$ shjs test.js 2>/dev/null
stdout is showing
stderr is showing
This suggests that something is at least broken in the shjs script if not somewhere else as well. I suspect that this is related, and points toward a bug related to the exec() function (shjs is essentially a wrapper for a call to exec('node ' + script_name + args); (see here).
I suspect it should just be modified to support capturing a process's stderr in addition to its stdout, and have both of these returned alongside the return code.
If I run:
I get:
So how do I get messages from standard error in JavaScript?
The text was updated successfully, but these errors were encountered: