summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2012-01-20 23:41:02 (GMT)
committerChristian Pointner <equinox@helsinki.at>2012-01-20 23:41:02 (GMT)
commite203e5fd849788fae923c3a9e5d9a03c6f29affc (patch)
treec53a1a5ff6196fc13f8f8cc70184e4c6c90f3441
parent1dba2c5177db50e79437e221076b3c0153e10c86 (diff)
output of pv script only if any returned
-rw-r--r--rhimport.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/rhimport.pm b/rhimport.pm
index fbecbc1..0d7fee8 100644
--- a/rhimport.pm
+++ b/rhimport.pm
@@ -330,7 +330,7 @@ sub delete_file
sub pv_add_note
{
my ( $title, $text, $id, $date, $type ) = @_;
- $type = 'n' unless $type;
+ $type = 'n' if undef($type);
# TODO: implement type as soon pv supports this
my @script = ('/usr/bin/ssh', 'root@intranet', 'addnote', $id, $date);
@@ -345,14 +345,16 @@ sub pv_add_note
print $writer $title . "\n" . $text;
close $writer;
waitpid $pid, 0;
+ $err_out = join('', <$error>);
+ $read_out = join('', <$reader>);
if ( $? >> 8 ) {
print "\n\nPV: adding note returned non-zero value\n";
- print "STDERR:\n" . join('', <$error>) . "\n";
- print "STDOUT:\n" . join('', <$reader>) . "\n";
+ print "STDERR:\n" . $err_out . "\n" unless $err_out eq '';
+ print "STDOUT:\n" . $read_out . "\n" unless $read_out eq '';
print "Ignoring failed headline import!\n";
} else {
- print join('', <$reader>) . "\n";
- print join('', <$error>) . "\n";
+ print $read_out . "\n" unless $read_out eq '';
+ print $err_out . "\n" unless $err_out eq '';
}
}