On 11-08-2014 12:02, bulk 88 wrote:
________________________________
Date: Mon, 11 Aug 2014 05:48:22 -0700
From: glasswal...@yahoo.com.br
Subject: Re: How do you handle a perl process that never seems to exit?
To: cpan-testers-discuss@perl.org

Hello there,

I found this part interesting in the code:

1537         if ($is_mswin || $is_vms) {
1538             # On Windows, try to get the 'real' PID
1539             if ($is_mswin) {
1540                 eval { require Win32; };
1541                 if (defined(&Win32::GetCurrentProcessId)) {
1542                     $pid_to_kill = Win32::GetCurrentProcessId();
1543                 }
1544             }

If it tries to load specific platform code, why not try to use the
Win32 API to take care of creating and removing a process (see
Win32::Process)?



Win32::Process doesnt support specifying the handles to use, so redirecting std 
handles is impossible using Win32::Process. The C Win32 CreateProcess takes 
file handles to use for std handles.
                                        

In this case I would suggest IPC::Open3::Callback: it uses sockets pairs to act as file handles, which seems to be well supported by Windows when using select().

See http://search.cpan.org/~ltheisen/IPC-Open3-Callback-1.14/lib/IPC/Open3/Callback.pm, the sub _win_open3 and _win_pipe.

Regards,

Alceu

Reply via email to