Re: How can I get the PID of the process started by Runtime.exec() on *nix - plattforms to kill it afterwards ?
Posted By:
Henrik_Gram
Posted On:
Wednesday, October 9, 2002 03:25 AM
Had a similar problem and I ended up doing:
sh -c 'echo $$ && exec sleep 234567'
This will print the pid of the shell that was started and since exec replaces the program image with the new one, the sleep process gets the same pid. You can use this with the Process object and then read the first line from it which will then contain the PID.
Cheers,
Henrik