From 3065503e6e921cb622f5b6cf606720ae5d095641 Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 6 Oct 2011 05:51:18 +0000 Subject: [PATCH] fix SSH export, from #831 --- FS/FS/part_export/shellcommands.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/FS/FS/part_export/shellcommands.pm b/FS/FS/part_export/shellcommands.pm index 4d603cbd2..6fe4254be 100644 --- a/FS/FS/part_export/shellcommands.pm +++ b/FS/FS/part_export/shellcommands.pm @@ -475,12 +475,16 @@ sub shellcommands_queue { sub ssh_cmd { #subroutine, not method use Net::OpenSSH; my $opt = { @_ }; - my $ssh = Net::OpenSSH->new($opt->{'user'}.'@'.$opt->{'host'}); + open my $def_in, '<', '/dev/null' or die "unable to open /dev/null\n"; + my $ssh = Net::OpenSSH->new( + $opt->{'user'}.'@'.$opt->{'host'}, + 'default_stdin_fh' => $def_in + ); die "Couldn't establish SSH connection: ". $ssh->error if $ssh->error; my $ssh_opt = {}; $ssh_opt->{'stdin_data'} = $opt->{'stdin_string'} - if exists($opt->{'stdin_string'}); + if exists($opt->{'stdin_string'}) and length($opt->{'stdin_string'}); my ($output, $errput) = $ssh->capture2($ssh_opt, $opt->{'command'}); die "Error running SSH command: ". $ssh->error if $ssh->error; -- 2.11.0