-
Notifications
You must be signed in to change notification settings - Fork 740
Closed
Labels
Milestone
Description
Node version (or tell us if you're using electron or some other framework):
v10.17.0
ShellJS version (the most recent version/Github branch you see the bug on):
0.8.3
Operating system:
Ubuntu 18.04.3 LTS (via Windows 10 WSL)
Description of the bug:
When running shell.exec(), passing in {fatal:true} option is ignored.
Other options seem to work correctly, and setting config.fatal globally has desired behavior.
Example ShellJS command to reproduce the error:
# Executing an invalid command
> shelljs.exec('foobar')
/bin/sh: 1: foobar: not found
{ [String: '']
stdout: '',
stderr: '/bin/sh: 1: foobar: not found\n',
code: 127,
cat: [Function: bound ],
exec: [Function: bound ],
grep: [Function: bound ],
head: [Function: bound ],
sed: [Function: bound ],
sort: [Function: bound ],
tail: [Function: bound ],
to: [Function: bound ],
toEnd: [Function: bound ],
uniq: [Function: bound ] }
# Same behavioir when passing in fatal:true
> shelljs.exec('foobar', {fatal:true})
/bin/sh: 1: foobar: not found
{ [String: '']
stdout: '',
stderr: '/bin/sh: 1: foobar: not found\n',
code: 127,
cat: [Function: bound ],
exec: [Function: bound ],
grep: [Function: bound ],
head: [Function: bound ],
sed: [Function: bound ],
sort: [Function: bound ],
tail: [Function: bound ],
to: [Function: bound ],
toEnd: [Function: bound ],
uniq: [Function: bound ] }
# Setting global option has expected behavior
> shelljs.config.fatal = true
true
> shelljs.exec('foobar')
/bin/sh: 1: foobar: not found
Thrown:
Error: exec: /bin/sh: 1: foobar: not found
at Object.error (/home/chris/sample/node_modules/shelljs/src/common.js:110:27)
at execSync (/home/chris/sample/node_modules/shelljs/src/exec.js:102:12)
at Object._exec (/home/chris/sample/node_modules/shelljs/src/exec.js:205:12)
at Object.exec (/home/chris/sample/node_modules/shelljs/src/common.js:335:23)
# Setting silent: true appears to have desired effect.
> shelljs.exec('foobar', {silent:true})
Thrown:
Error: exec: /bin/sh: 1: foobar: not found
at Object.error (/home/chris/sample/node_modules/shelljs/src/common.js:110:27)
at execSync (/home/chris/sample/node_modules/shelljs/src/exec.js:102:12)
at Object._exec (/home/chris/sample/node_modules/shelljs/src/exec.js:205:12)
at Object.exec (/home/chris/sample/node_modules/shelljs/src/common.js:335:23)
frosas