diff options
author | cjihrig <cjihrig@gmail.com> | 2017-10-30 16:14:15 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2017-11-10 14:27:52 -0500 |
commit | 3cacd34dc2c5da4c01c8fd09c34a816357358c8b (patch) | |
tree | 9061bc03a2148de32e658f149d1305238a33da5a /src | |
parent | 766cd1f59d5adb03953656391e63b4186c9aff10 (diff) | |
download | android-node-v8-3cacd34dc2c5da4c01c8fd09c34a816357358c8b.tar.gz android-node-v8-3cacd34dc2c5da4c01c8fd09c34a816357358c8b.tar.bz2 android-node-v8-3cacd34dc2c5da4c01c8fd09c34a816357358c8b.zip |
src: add process.ppid
Fixes: https://github.com/nodejs/node/issues/14957
PR-URL: https://github.com/nodejs/node/pull/16839
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc index 486ed9435a..563dec7896 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2906,6 +2906,12 @@ static void EnvEnumerator(const PropertyCallbackInfo<Array>& info) { } +static void GetParentProcessId(Local<Name> property, + const PropertyCallbackInfo<Value>& info) { + info.GetReturnValue().Set(Integer::New(info.GetIsolate(), uv_os_getppid())); +} + + static Local<Object> GetFeatures(Environment* env) { EscapableHandleScope scope(env->isolate()); @@ -3238,6 +3244,9 @@ void SetupProcessObject(Environment* env, READONLY_PROPERTY(process, "pid", Integer::New(env->isolate(), getpid())); READONLY_PROPERTY(process, "features", GetFeatures(env)); + process->SetAccessor(FIXED_ONE_BYTE_STRING(env->isolate(), "ppid"), + GetParentProcessId); + auto need_immediate_callback_string = FIXED_ONE_BYTE_STRING(env->isolate(), "_needImmediateCallback"); CHECK(process->SetAccessor(env->context(), need_immediate_callback_string, |