Subject: | Win32::Job fail to spawn jobs |
Win32::Job failes to spawn jobss on Vista builds newer then 3553 (
3542, 3562) and so on.
Failes with "Access is denied" message. If launched from cmd by hands -
all works fine, on doubleclick and autostart - failes.
Here are test scripts. Try toexecute it from cmd and doubleclick to see
the difference.
This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 25 registered patches, see perl -V for more detail)
Copyright 1987-2006, Larry Wall
Binary build 817 [257965] provided by ActiveState http://www.
ActiveState.com
Built Mar 20 2006 17:54:25
1. libwin32 [0.26.0.1]
Tested on a coulple of configurations on clean install.
Subject: | run.pl |
#!usr/bin/perl
#
use FindBin qw($Bin);
system ("perl \"$Bin\\spawner.pl\"");
Subject: | bench.pl |
#!usr/bin/perl
#
while (<STDIN>)
{
chomp;
print STDOUT ("$_\n");
}
Subject: | in.txt |
test
Subject: | spawner.pl |
#!usr/bin/perl
#
use FindBin qw($Bin);
print F "Starting!\n";
use Win32::Job;
$Script = "$Bin\\bench.pl";
$XMLInput = "$Bin\\in.txt";
$XMLOutput = "$Bin\\out.txt";
$Timeout = 1000;
open (F,">log.txt");
my $Job = new Win32::Job;
my $PId = $Job->spawn (
$^X,
"perl $Script",
{
stdin => $XMLInput,
stdout=> $XMLOutput,
# stderr => <STDERR>
}
);
if (defined ($PId))
{
print "Spawned job with PId = $PId, will wait for $Timeout sec.\n";
print F "Spawned job with PId = $PId, will wait for $Timeout sec.\n";
}
else
{
print "Spawn failed: $^E";
print F "Spawn failed: $^E";
return 2;
}
unless ($Job->run($Timeout, 1))
{
print "Job seems to hang. Killing.\n";
print F "Job seems to hang. Killing.\n";
$Job->kill();
return 3;
}
else
{
print "Successfully finished the job\n";
print F "Successfully finished the job\n";
}