get PID on Windows with Perl
I am tring to get the pid of a system command in Perl like this:
Win32::Process::Create($ProcessObj,TOOLS_DIR.ZIP_TOOL, $l_command, 0,
NORMAL_PRIORITY_CLASS, ".")
|| err_exit(Win32::FormatMessage( Win32::GetLastError() ));
$PID = $ProcessObj->GetProcessID();
in order to kill it later if is need;
where TOOLS_DIR.ZIP_TOOL is path to my tools/7za.exe and $l_command is
some ARGV for 7za tool.
My problem is that returned pid is the one of cmd who lunch the command
not the 7za.exe pid, so if I kill this pid, the unzip process will
continue until is finish. I will like to be able to stop the unzip process
based on his pid.
The fork() is not useful in my case becouse on Windows is returning
nogative pids ...
Any help will be apreciated.
 
No comments:
Post a Comment