Skip to content
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

Add getppid op for moarvm #381

Closed
wants to merge 1 commit into from
Closed

Add getppid op for moarvm #381

wants to merge 1 commit into from

Conversation

ugexe
Copy link
Contributor

@ugexe ugexe commented Nov 8, 2017

Allows a child process to get the parent process id, and thus guess if it has become orphaned.

Allows a child process to get the parent process id, and thus know
if it has become orphaned.
@ugexe
Copy link
Contributor Author

ugexe commented Nov 8, 2017

Requires: MoarVM/MoarVM#748

This node PR should make the js implementation simple enough once it lands.

Java 9 is adding a Process/ProcessHandle interface that should make this trivial (as well as an alternative to the jvm backends current implementation of getpid), but not sure about Java 8


An example of child determining that the parent process is no longer running:

./install/bin/perl6 -e 'use nqp; say "Original PID: " ~ nqp::getpid(); start shell q|nqp-m -e "nqp::say(\"Parent PID pre-exit: \" ~ nqp::getppid() ~ nqp::if(nqp::sleep(5),\"\nParent PID post-exit: \") ~ nqp::getppid())"|; sleep 1;'
Original PID: 33299
Parent PID pre-exit: 33299
Parent PID post-exit: 1

@ugexe ugexe closed this Nov 24, 2017
@ugexe ugexe mentioned this pull request Feb 22, 2018
ugexe added a commit that referenced this pull request Feb 24, 2018
Allows a child process to get the parent process id, and thus
guess if it has become orphaned.

See: #381
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant