Reputation: 271
I create a child process using 'Runtime.getRuntime().exec()' in java and want to detect when child process exits. so i want to know is there any signal like 'SIGCHILD' in posix?
Upvotes: 1
Views: 310
Reputation: 81724
No, not precisely. You can call Process.waitFor()
to wait for the process to exit. If you did that from a dedicated thread, however, that would be quite similar to a signal handler. Alternatively, a more expensive method is to poll Process.exitValue()
, which will throw an exception until the child has actually exited.
Upvotes: 1