summaryrefslogtreecommitdiff
path: root/FugueConfig.pm
diff options
context:
space:
mode:
Diffstat (limited to 'FugueConfig.pm')
-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