-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to get the ppid of a process? #14957
Comments
This feature request would most likely have to be submitted to the libuv issue tracker as it would need to be added there first. Be aware though, Windows doesn't really have the same kind of support for parent pids like *nix does, in that you can only get the original parent process id (which may/may not have been assigned to another process if the original parent process has since died). |
|
Depending on your need, this is working for me, though I'm not looking for a specific PPID, I'm looking for a "stable" PPID that I can use for a "session" across multiple CLI commands. This may be the proper PPID for the current process, however, I think I saw that this was still a child process of bash.
|
@bnoordhuis the ppid implementation is kind of ugly on Windows. We happen to already have it in libuv though. Would you be opposed to me exposing it from there and using it here? |
Refs: nodejs/node#14957 PR-URL: libuv#1610 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This will be available in the next libuv release, at which point I'll open a PR to expose it in Node. |
Fixes: nodejs#14957 PR-URL: nodejs#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>
I want to let child process know if it's parent was killed, so I hope the child process can get it's ppid.
If ppid == 1, then i can know the parent has died.
But process module seems not having this prop or method
The text was updated successfully, but these errors were encountered: