--- nfo/perl/libs/shortcuts.pm 2003/06/24 20:21:12 1.15 +++ nfo/perl/libs/shortcuts.pm 2003/06/25 22:49:56 1.16 @@ -1,7 +1,10 @@ ## --------------------------------------------------------------------------- -## $Id: shortcuts.pm,v 1.15 2003/06/24 20:21:12 jonen Exp $ +## $Id: shortcuts.pm,v 1.16 2003/06/25 22:49:56 joko Exp $ ## --------------------------------------------------------------------------- ## $Log: shortcuts.pm,v $ +## Revision 1.16 2003/06/25 22:49:56 joko +## RUNNING_IN_HELL mode for detach option +## ## Revision 1.15 2003/06/24 20:21:12 jonen ## + changed linux part of run_cmd to use Proc::Background instead of IPC::... ## @@ -212,12 +215,14 @@ $cmd = "$application$cmd" if $application; #} + my @cmd = split(' ', $cmd); + # V3 - using IPC (optional) if ($options->{async}) { #run \@cmd, \$in, \$out, \$err, timeout( 10 ) or die "cat: $?"; - my @cmd = split(' ', $cmd); - + + print STDOUT "run_cmd[async]: Proc::Background: $cmd", "\n"; # V3.1 - using IPC::Run # @@ -226,7 +231,6 @@ if (RUNNING_IN_HELL()) { #my $in; my $out; my $err; - print STDOUT "run_cmd: IPC::Run: $cmd", "\n"; #print STDOUT "findpath: ", findpath('rap.pl'), "\n"; @@ -318,8 +322,15 @@ } elsif ($options->{detach}) { - print STDERR "run_cmd: system('$cmd' &).", "\n"; - system($cmd . ' &'); + + if (RUNNING_IN_HELL()) { + print STDOUT "run_cmd[detach]: Proc::Background: $cmd", "\n"; + my $proc1 = Proc::Background->new(@cmd); + print "pid: ", $proc1->pid(), "\n"; + } else { + print STDERR "run_cmd[detach]: system('$cmd' &).", "\n"; + system($cmd . ' &'); + } } else { print STDOUT "run_cmd: system('$cmd').", "\n";