We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
execSync redirects stderr to stdout:
sh = require('execSync'); var stdout = sh.exec('echo my_error >&2').stdout; console.log('stdout: ' + stdout); // stdout: my_error
However, it would be preferable (IMO) if it worked like this instead:
var sh = require('execSync'); var stdout = sh.exec('echo my_output').stdout; var stderr = sh.exec('echo my_error >&2').stderr; console.log('stdout: ' + stdout + ' ; stderr: ' + stderr); // stdout: my_output ; stderr: my_error
The text was updated successfully, but these errors were encountered:
You can work around this by manually redirect stdErr and stdOut when invoking run, ie:
run
var stdOutTmpFile = temp.openSync("cmd-stdout").path; var stdErrTmpFile = temp.openSync("cmd-stderr").path; var statusCode = execSync.run(cmd + " 1> " + stdOutTmpFile + " 2> " + stdErrTmpFile); console.log(fs.readFileSync(stdOutTmpFile.toString())); console.log(fs.readFileSync(stdErrTmpFile.toString()));
Sorry, something went wrong.
No branches or pull requests
execSync redirects stderr to stdout:
However, it would be preferable (IMO) if it worked like this instead:
The text was updated successfully, but these errors were encountered: