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)
commitb410598227da80a48dba3df4246c4426e873c654 (patch)
treec53a1a5ff6196fc13f8f8cc70184e4c6c90f3441
parent7fcaad9eadba6a3968c2b24526ce69db3d1b4de0 (diff)
output of pv script only if any returned
git-svn-id: https://svn.helsinki.at/rhimport/trunk@119 7c65635b-ec39-4f67-a626-873dbafdd612
-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 '';
}
}