Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2017-02-10 18:00:19 +0300
committercjihrig <cjihrig@gmail.com>2017-02-14 19:44:24 +0300
commit784eb2fd65ab0e17f3ec15b801c8e9d78866681a (patch)
tree8cffe634a3d54448ed319f5a932b38e01e7e0f0d /src/spawn_sync.cc
parentb7ac0b25b86d6c014117927f04f9290ae160109e (diff)
child_process: exit spawnSync with null on signal
This commit sets the spawnSync() exit code to null when the child is killed via signal. This brings the behavior more in sync with spawn(). Fixes: https://github.com/nodejs/node/issues/11284 PR-URL: https://github.com/nodejs/node/pull/11288 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
Diffstat (limited to 'src/spawn_sync.cc')
-rw-r--r--src/spawn_sync.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc
index 93e51af38f6..8ef78a796db 100644
--- a/src/spawn_sync.cc
+++ b/src/spawn_sync.cc
@@ -650,12 +650,17 @@ Local<Object> SyncProcessRunner::BuildResultObject() {
Integer::New(env()->isolate(), GetError()));
}
- if (exit_status_ >= 0)
- js_result->Set(env()->status_string(),
- Number::New(env()->isolate(), static_cast<double>(exit_status_)));
- else
+ if (exit_status_ >= 0) {
+ if (term_signal_ > 0) {
+ js_result->Set(env()->status_string(), Null(env()->isolate()));
+ } else {
+ js_result->Set(env()->status_string(),
+ Number::New(env()->isolate(), static_cast<double>(exit_status_)));
+ }
+ } else {
// If exit_status_ < 0 the process was never started because of some error.
js_result->Set(env()->status_string(), Null(env()->isolate()));
+ }
if (term_signal_ > 0)
js_result->Set(env()->signal_string(),