Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
On timeout I tried killing the child proces but the exe is still alive.I have two questions here: 1) Is there any way I can access the pid of the exe (called from the child process) from the parent process? Reason: I tried Win32::Proc but the obj handle was not visible to the parent. I had the same issue while using pipes. 2) Is there a better way to monitor the child process? Restriction: I'm forced to use only the standard modules and hence unable to download and use CPAN modules. I'd appreciate any help on the issue.$pid = fork; # Fork error if ( !defined($pid) ) { print "ERROR: fork()\n"; exit; } elsif ( $pid == 0 ) { exec('C:\WINNT\system32\calc.exe'); exit; } else { # Parent process # Monitors the child process for maximum timeout # on timeout kill 9,$pid; exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: kill a process with process name
by BrowserUk (Patriarch) on Apr 13, 2010 at 13:09 UTC | |
by Anonymous Monk on Apr 14, 2010 at 12:37 UTC | |
by BrowserUk (Patriarch) on Apr 14, 2010 at 14:12 UTC | |
by Anonymous Monk on Apr 16, 2010 at 08:44 UTC | |
by BrowserUk (Patriarch) on Apr 16, 2010 at 15:18 UTC | |
|
Re: kill a process with process name
by cdarke (Prior) on Apr 13, 2010 at 16:15 UTC | |
by Anonymous Monk on Apr 14, 2010 at 09:00 UTC |