--- nfo/perl/libs/shortcuts.pm 2003/06/24 20:21:12 1.15 +++ nfo/perl/libs/shortcuts.pm 2003/12/05 04:58:04 1.18 @@ -1,7 +1,16 @@ ## --------------------------------------------------------------------------- -## $Id: shortcuts.pm,v 1.15 2003/06/24 20:21:12 jonen Exp $ +## $Id: shortcuts.pm,v 1.18 2003/12/05 04:58:04 joko Exp $ ## --------------------------------------------------------------------------- ## $Log: shortcuts.pm,v $ +## Revision 1.18 2003/12/05 04:58:04 joko +## + minor update: doesn't require IPC::Session anymore +## +## Revision 1.17 2003/07/02 11:17:32 jonen +## minor changes +## +## 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::... ## @@ -78,7 +87,7 @@ use Carp; # NEW - 2003-06-23 for Linux (what about *BSD?) -use IPC::Session; +#use IPC::Session; use File::Spec; use Proc::Background; @@ -212,12 +221,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 +237,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,11 +328,19 @@ } 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 STDOUT "run_cmd[detach]: system('$cmd' &).", "\n"; + system($cmd . ' &'); + } } else { print STDOUT "run_cmd: system('$cmd').", "\n"; + #print $ENV{PERL5LIB}, "\n"; system($cmd); }