2 |
## $Id$ |
## $Id$ |
3 |
## --------------------------------------------------------------------------- |
## --------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.18 2003/12/05 04:58:04 joko |
6 |
|
## + minor update: doesn't require IPC::Session anymore |
7 |
|
## |
8 |
|
## Revision 1.17 2003/07/02 11:17:32 jonen |
9 |
|
## minor changes |
10 |
|
## |
11 |
|
## Revision 1.16 2003/06/25 22:49:56 joko |
12 |
|
## RUNNING_IN_HELL mode for detach option |
13 |
|
## |
14 |
## Revision 1.15 2003/06/24 20:21:12 jonen |
## Revision 1.15 2003/06/24 20:21:12 jonen |
15 |
## + changed linux part of run_cmd to use Proc::Background instead of IPC::... |
## + changed linux part of run_cmd to use Proc::Background instead of IPC::... |
16 |
## |
## |
87 |
use Carp; |
use Carp; |
88 |
|
|
89 |
# NEW - 2003-06-23 for Linux (what about *BSD?) |
# NEW - 2003-06-23 for Linux (what about *BSD?) |
90 |
use IPC::Session; |
#use IPC::Session; |
91 |
|
|
92 |
use File::Spec; |
use File::Spec; |
93 |
use Proc::Background; |
use Proc::Background; |
221 |
$cmd = "$application$cmd" if $application; |
$cmd = "$application$cmd" if $application; |
222 |
#} |
#} |
223 |
|
|
224 |
|
my @cmd = split(' ', $cmd); |
225 |
|
|
226 |
# V3 - using IPC (optional) |
# V3 - using IPC (optional) |
227 |
if ($options->{async}) { |
if ($options->{async}) { |
228 |
|
|
229 |
#run \@cmd, \$in, \$out, \$err, timeout( 10 ) or die "cat: $?"; |
#run \@cmd, \$in, \$out, \$err, timeout( 10 ) or die "cat: $?"; |
230 |
my @cmd = split(' ', $cmd); |
|
231 |
|
print STDOUT "run_cmd[async]: Proc::Background: $cmd", "\n"; |
232 |
|
|
233 |
# V3.1 - using IPC::Run |
# V3.1 - using IPC::Run |
234 |
# |
# |
237 |
if (RUNNING_IN_HELL()) { |
if (RUNNING_IN_HELL()) { |
238 |
|
|
239 |
#my $in; my $out; my $err; |
#my $in; my $out; my $err; |
|
print STDOUT "run_cmd: IPC::Run: $cmd", "\n"; |
|
240 |
|
|
241 |
#print STDOUT "findpath: ", findpath('rap.pl'), "\n"; |
#print STDOUT "findpath: ", findpath('rap.pl'), "\n"; |
242 |
|
|
328 |
|
|
329 |
|
|
330 |
} elsif ($options->{detach}) { |
} elsif ($options->{detach}) { |
331 |
print STDERR "run_cmd: system('$cmd' &).", "\n"; |
|
332 |
system($cmd . ' &'); |
if (RUNNING_IN_HELL()) { |
333 |
|
print STDOUT "run_cmd[detach]: Proc::Background: $cmd", "\n"; |
334 |
|
my $proc1 = Proc::Background->new(@cmd); |
335 |
|
print "pid: ", $proc1->pid(), "\n"; |
336 |
|
} else { |
337 |
|
print STDOUT "run_cmd[detach]: system('$cmd' &).", "\n"; |
338 |
|
system($cmd . ' &'); |
339 |
|
} |
340 |
|
|
341 |
} else { |
} else { |
342 |
print STDOUT "run_cmd: system('$cmd').", "\n"; |
print STDOUT "run_cmd: system('$cmd').", "\n"; |
343 |
|
#print $ENV{PERL5LIB}, "\n"; |
344 |
system($cmd); |
system($cmd); |
345 |
} |
} |
346 |
|
|