summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoretienne2004-03-15 12:16:35 +0000
committeretienne2004-03-15 12:16:35 +0000
commit7715d8ac80f1c05d4278d8823dc393fa88f0458c (patch)
treef5bab5c47a34869fb4407bdee9e3f3853f45cd75
parentc24701e01c05d7e1717e5cfd4e8c481b7172cdc3 (diff)
downloadivylaunch-7715d8ac80f1c05d4278d8823dc393fa88f0458c.zip
ivylaunch-7715d8ac80f1c05d4278d8823dc393fa88f0458c.tar.gz
ivylaunch-7715d8ac80f1c05d4278d8823dc393fa88f0458c.tar.bz2
ivylaunch-7715d8ac80f1c05d4278d8823dc393fa88f0458c.tar.xz
Correction : blocage sur execution des commandes (hors agent ivy).
-rw-r--r--FugueConfig.pm26
1 files changed, 18 insertions, 8 deletions
diff --git a/FugueConfig.pm b/FugueConfig.pm
index c05d8f7..806e19d 100644
--- a/FugueConfig.pm
+++ b/FugueConfig.pm
@@ -121,16 +121,26 @@ sub launchCommand {
my ($type, $host, $command, $options) = @_;
my @options = @$options if ref($options) eq 'ARRAY';
my $command_opt = $command.' '.join(' ', @options);
- print "*** FugueConfig::launchCommand INFO: $host: launching command ".
- "\'$command_opt\'\n";
- my $awk_command = "awk -W interactive '{print \"$type  \", \$0;}'";
- if ($host eq 'localhost' or $host eq hostname() ) {
- $command = "$command_opt | $awk_command ";
+ my $pid = fork;
+ if ($pid) {
+ # parent
+ print "*** FugueConfig::launchCommand INFO: $host: launching command ".
+ "\'$command_opt\' (pid=$pid)\n";
+ return ($pid);
} else {
- $command = "$rsh $host '$command_opt' | $awk_command ";
+ # child
+ my $awk_command = "awk -W interactive '{print \"$type  \", \$0;}'";
+ if ($host eq 'localhost' or $host eq hostname() ) {
+ exec "$command_opt 2>&1 | $awk_command" or
+ warn "*** FugueConfig::launchCommand WARNING: Error executing ".
+ "$command\n";
+ } else {
+ exec "$rsh -n $host '$command_opt' 2>&1 | $awk_command "
+ or warn "*** FugueConfig::launchCommand WARNING: Error executing ".
+ "$command on $host\n";
+ }
}
-# print "$HEADER launching command $command\n";
- system ($command);
+
} # end launchCommand