summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2017-02-10 10:00:19 -0500
committercjihrig <cjihrig@gmail.com>2017-02-14 11:44:24 -0500
commit784eb2fd65ab0e17f3ec15b801c8e9d78866681a (patch)
tree8cffe634a3d54448ed319f5a932b38e01e7e0f0d /src
parentb7ac0b25b86d6c014117927f04f9290ae160109e (diff)
downloadandroid-node-v8-784eb2fd65ab0e17f3ec15b801c8e9d78866681a.tar.gz
android-node-v8-784eb2fd65ab0e17f3ec15b801c8e9d78866681a.tar.bz2
android-node-v8-784eb2fd65ab0e17f3ec15b801c8e9d78866681a.zip
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')
-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 93e51af38f..8ef78a796d 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(),