Skip Menu |

This queue is for tickets about the PAR-Packer CPAN distribution.

Report information
The Basics
Id: 65745
Status: resolved
Priority: 0/
Queue: PAR-Packer

People
Owner: Nobody in particular
Requestors: dirk [...] dirkundsari.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Hello, I think it is not a bug, but I'm very interested in a workaround. If I create a process from a perl script with "open" or "Win32::Process::Create" and this process is a "pp packed executable" then it is NOT possible to send it the kill signal. Because the "pid" I get from "open" or "Win32::Process::Create" does NOT seem to be the pid of the unpacked perl script which is finally doing the work. Here an example without a "pp packed executable": "counter.pl": This is the child process. <code> use strict; use warnings; $|=1; print "$_\n" and select(undef,undef,undef,0.1) for 1 .. 1000; </code> And now the perl script which is creating a child process (without "pp packed executable"): <code> use strict; use warnings; use Win32::Process; use Win32; sub ErrorReport { print Win32::FormatMessage( Win32::GetLastError() ); } my $ProcessObj; Win32::Process::Create($ProcessObj, "C:\\Perl\\bin\\perl.exe", "perl counter.pl", 1, CREATE_NEW_PROCESS_GROUP, ".")|| die ErrorReport(); $ProcessObj->Suspend(); sleep(1); $ProcessObj->Resume(); sleep(1); $ProcessObj->Suspend(); sleep(1); $ProcessObj->Resume(); sleep(3); $ProcessObj->Kill(0); </code> This is working. It is possible to suspend, resume and kill the child process. Now I am doing exactly the same with an "pp packed executable". "counter.exe" which was created with "pp -o counter.exe counter.pl". <code> use strict; use warnings; use Win32::Process; use Win32; sub ErrorReport { print Win32::FormatMessage( Win32::GetLastError() ); } my $ProcessObj; Win32::Process::Create($ProcessObj, ".\\counter.exe", "counter", 1, CREATE_NEW_PROCESS_GROUP, ".")|| die ErrorReport(); $ProcessObj->Suspend(); sleep(1); $ProcessObj->Resume(); sleep(1); $ProcessObj->Suspend(); sleep(1); $ProcessObj->Resume(); sleep(3); $ProcessObj->Kill(0); </code> Now the create is working again. But the suspend, resume and kill are NOT working. It's now clear for me that a "pp packed executable" extracts everything to a temporary directory and then executes the unpacked script. What could be a workaround that makes it possible to send a signal to a "pp packed executable? I'm using Version 1.007 of Par::Packer and perl 5.10 (ActiveState) on Windows. But I think that it is a general problem. Thank you very much for your help. Dirk
On 2011-02-15 13:31:40, Dirk80 wrote: Show quoted text
> If I create a process from a perl script with "open" or > "Win32::Process::Create" and this process is a "pp packed executable" > then it is NOT possible to send it the kill signal. Because the "pid" I > get from "open" or "Win32::Process::Create" does NOT seem to be the pid > of the unpacked perl script which is finally doing the work.
Your observation is correct, but can't be fixed: it's due to how PAR::Packer works (and the fact that Windows doesn't have a exec system call, only spawn). Cheers, Roderich