зеркало из https://github.com/microsoft/shelljs.git
Kept existing options and re-wrote the test case.
This commit is contained in:
Родитель
a996918f84
Коммит
7b9ee5a41d
4
shell.js
4
shell.js
|
@ -1102,8 +1102,8 @@ function _exec(command, options, callback) {
|
|||
}
|
||||
|
||||
// Callback is defined with options.
|
||||
if (typeof callback === 'function') {
|
||||
options = { async: true };
|
||||
if (typeof options === 'object' && typeof callback === 'function') {
|
||||
options.async = true;
|
||||
}
|
||||
|
||||
options = extend({
|
||||
|
|
17
test/exec.js
17
test/exec.js
|
@ -91,16 +91,17 @@ shell.exec('node -e \"console.log(5678);\"', function(code, output) {
|
|||
assert.equal(code, 0);
|
||||
assert.ok(output === '5566\n' || output === '5566\nundefined\n'); // 'undefined' for v0.4
|
||||
|
||||
shell.exit(123);
|
||||
//
|
||||
// callback as 3rd argument (slient:true)
|
||||
//
|
||||
shell.exec('node -e \"console.log(5678);\"', {silent:true}, function(code, output) {
|
||||
assert.equal(code, 0);
|
||||
assert.ok(output === '5678\n' || output === '5678\nundefined\n'); // 'undefined' for v0.4
|
||||
|
||||
});
|
||||
shell.exit(123);
|
||||
|
||||
});
|
||||
|
||||
//
|
||||
// callback as 3rd argument (slient:true)
|
||||
//
|
||||
shell.exec('node -e \"console.log(5678);\"', {silent:true}, function(code, output) {
|
||||
assert.equal(code, 0);
|
||||
assert.ok(output === '5678\n' || output === '5678\nundefined\n'); // 'undefined' for v0.4
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче