Subject: | IPC::Cmd could use Win32::Job |
That primary problem people seem to have trying to do that fork , redirect, exec idiom, which doesn't work on win32 where forks == threads, is reasonably straight forward to do with Win32::Job
It wraps the internal win32 create process command so that you can specify arbitrary input and ouput handles as parameters, and IPC::Cmd could try using this if it was present ( and recommend via runtime.recommends )
use Win32::Job;
my $process = Win32::Job->new();
$process->spawn("$binarypath", "@ARGS" , {
stdin => $handle,
stdout => $other_handle,
stderr => $other_err_handle
});
$process->run(-1);
run() blocks until the process terminates, so you still want to do this in a fork() with a cleanup on the child when the fork exits.
I have a working example implementation of something that would be easier to implement in IPC::Cmd if it had Win32 Fork support, using Win32::Job
https://metacpan.org/source/KENTNL/IPC-Run-Fused-0.04000100/lib/IPC/Run/Fused/Win32.pm
It wraps the internal win32 create process command so that you can specify arbitrary input and ouput handles as parameters, and IPC::Cmd could try using this if it was present ( and recommend via runtime.recommends )
use Win32::Job;
my $process = Win32::Job->new();
$process->spawn("$binarypath", "@ARGS" , {
stdin => $handle,
stdout => $other_handle,
stderr => $other_err_handle
});
$process->run(-1);
run() blocks until the process terminates, so you still want to do this in a fork() with a cleanup on the child when the fork exits.
I have a working example implementation of something that would be easier to implement in IPC::Cmd if it had Win32 Fork support, using Win32::Job
https://metacpan.org/source/KENTNL/IPC-Run-Fused-0.04000100/lib/IPC/Run/Fused/Win32.pm