2 |
## $Id$ |
## $Id$ |
3 |
## --------------------------------------------------------------------------- |
## --------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.17 2003/07/02 11:17:32 jonen |
6 |
|
## minor changes |
7 |
|
## |
8 |
|
## Revision 1.16 2003/06/25 22:49:56 joko |
9 |
|
## RUNNING_IN_HELL mode for detach option |
10 |
|
## |
11 |
## Revision 1.15 2003/06/24 20:21:12 jonen |
## Revision 1.15 2003/06/24 20:21:12 jonen |
12 |
## + 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::... |
13 |
## |
## |
218 |
$cmd = "$application$cmd" if $application; |
$cmd = "$application$cmd" if $application; |
219 |
#} |
#} |
220 |
|
|
221 |
|
my @cmd = split(' ', $cmd); |
222 |
|
|
223 |
# V3 - using IPC (optional) |
# V3 - using IPC (optional) |
224 |
if ($options->{async}) { |
if ($options->{async}) { |
225 |
|
|
226 |
#run \@cmd, \$in, \$out, \$err, timeout( 10 ) or die "cat: $?"; |
#run \@cmd, \$in, \$out, \$err, timeout( 10 ) or die "cat: $?"; |
227 |
my @cmd = split(' ', $cmd); |
|
228 |
|
print STDOUT "run_cmd[async]: Proc::Background: $cmd", "\n"; |
229 |
|
|
230 |
# V3.1 - using IPC::Run |
# V3.1 - using IPC::Run |
231 |
# |
# |
234 |
if (RUNNING_IN_HELL()) { |
if (RUNNING_IN_HELL()) { |
235 |
|
|
236 |
#my $in; my $out; my $err; |
#my $in; my $out; my $err; |
|
print STDOUT "run_cmd: IPC::Run: $cmd", "\n"; |
|
237 |
|
|
238 |
#print STDOUT "findpath: ", findpath('rap.pl'), "\n"; |
#print STDOUT "findpath: ", findpath('rap.pl'), "\n"; |
239 |
|
|
325 |
|
|
326 |
|
|
327 |
} elsif ($options->{detach}) { |
} elsif ($options->{detach}) { |
328 |
print STDERR "run_cmd: system('$cmd' &).", "\n"; |
|
329 |
system($cmd . ' &'); |
if (RUNNING_IN_HELL()) { |
330 |
|
print STDOUT "run_cmd[detach]: Proc::Background: $cmd", "\n"; |
331 |
|
my $proc1 = Proc::Background->new(@cmd); |
332 |
|
print "pid: ", $proc1->pid(), "\n"; |
333 |
|
} else { |
334 |
|
print STDOUT "run_cmd[detach]: system('$cmd' &).", "\n"; |
335 |
|
system($cmd . ' &'); |
336 |
|
} |
337 |
|
|
338 |
} else { |
} else { |
339 |
print STDOUT "run_cmd: system('$cmd').", "\n"; |
print STDOUT "run_cmd: system('$cmd').", "\n"; |