Subject: | libwin32 [0.19.1], Win32::Job, status() |
Windows XP Professional,Version 2002, Service Pack 1
ActivePerl 5.6.1.633
===============================================================
use strict;
use Win32::Job;
use Sys::Hostname;
use Data::Dumper;
my $job;
my $args;
my $pid;
my $prog;
my $host;
my $ok;
my $rc;
my %stat;
my $timeout = 24*60*60; #seconds
$host = hostname;
$args = join(' ',@ARGV); #note: these are args that ri.bat would have
$prog = 'I:\PerlProjects\no_ctl_c\my_ri.bat'; # TODO: pick right ri.bat
$job = Win32::Job->new;
$pid = $job->spawn($prog,$args,{no_window => 2});
print STDERR "\n";
print STDERR "host = $host\n";
print STDERR "prog = $prog\n";
print STDERR "args = $args\n";
print STDERR "pid = $pid\n";
$ok = $job->run($timeout);
unless($ok){
print STDERR "timed out!\n";
}
%stat = $job->status();
$Data::Dumper::Indent = 1;
$Data::Dumper::Purity = 1;
$Data::Dumper::Deepcopy = 1;
print STDERR Data::Dumper->Dump( [ \%stat ], [ '*stat' ] );
print STDERR "\n";
===============================================================
result is:
host = expert-32wq32m7
prog = I:\PerlProjects\no_ctl_c\my_ri.bat
args = tnoctl.pl
pid = 5848
%stat = (
'HASH(0x183f12c)' => undef
);