summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 '';
}
}