NORMALLY:
Smedge2 --executes--> Render.exe
MY-WRAPPED VERSION:
Smedge2 --executes--> RenderWrap.pl --executes--> Render.exe
####
C:\wrappers\RenderWrap.pl -some args
* - output etc *
^C
In cleanup.
####
#!/usr/bin/perl -w
$|++;
open ( LOG , '>>c:\temp\wrapper.log' );
# debug
print LOG "#"x40, $/;
print LOG "PID : $$" , $/;
print LOG join (',' , @ARGV) , $/;
my $mayabatch = 'mayabatch';
$SIG{TERM}=\&cleanup;
$SIG{KILL}=\&cleanup;
$SIG{INT}=\&cleanup;
$SIG{ABRT}=\&cleanup;
$SIG{BREAK}=\&cleanup;
$SIG{STOP}=\&cleanup;
$SIG{QUIT}=\&cleanup;
my %o;
$o{-file} = shift @ARGV;
my @args = @ARGV;
while ( @args ) {
my $arg = shift @args;
if ($arg =~ /-ses/) {
$o{-s} = shift @args;
$o{-e} = shift @args;
$o{-b} = shift @args;
}
elsif ( $arg =~ /^-/ ) {
$o{$arg}=shift @args;
}
else { warn "Unhandled arg $arg \n"; }
}
# blah blah, operations on args to wrap
# neatly.
#
my $child = open ( RENDER , "$command |" ) or die "Screaming $!$?\n";
while () {
print
};
print "Child exit status was $?" , $/;
exit $?;
sub cleanup {
warn "In cleanup. \n";
kill "HUP" , $child;
}