I must be using this wrong on Windows. The code works on Unix, but seems to hang on Windows. A secondary problem is that the filehandles seem to get messed up, which I'm guessing is due to the way forking is emulated on Windows. Here's a snippet (strict/warnings/etc implied).
my $cv = AnyEvent::Util::run_cmd(
[ $^X, -e => 'print "hello $^V\n"; exit 3' ],
'>' => '/my.out', # for simplicity - somewhere that I have write ac
+cess is being used
'2>' => '/my.err',
);
print "Started.\n"; # this goes to /my.out on windows, to the terminal
+ on unix
my $rc = $cv->recv; # this hangs on windows, returns nearly instantly
+on unix
I've tried with both 32-bit perl 5.10.0 (ActiveState) and 64-bit 5.22.1 (unknown source), and got the same results. (Windows 2008, but I doubt that matters.)
I started out with a reduced-functionality version of run_cmd, with an intention to eventually move to AE, but it had some similar problems, and I figured that the AE author may have worked around those problems already, so I started testing with AE instead, got stuck here. If AE doesn't work here, I may be forced to try to find a solution to my reduced-functionality version (which mostly was around the fork/filehandle issue - I'm sure I can resolve that, in a subprocess if I have to), but I'm figuring there has to be a simpler way, preferably one that will eventually allow me to read in both stdout and stderr without the temporary files.
Any suggestions would be appreciated.