diff options
author | mark <mark> | 2011-10-06 05:51:00 +0000 |
---|---|---|
committer | mark <mark> | 2011-10-06 05:51:00 +0000 |
commit | 56fcdd00d4aa83e7a77196651e865de5edcd0fae (patch) | |
tree | 207a797844ee0715906b0896078faa3026106599 /FS | |
parent | e4ad23d4e7025994333e00fc1eb69793637af838 (diff) |
fix SSH export, from #831
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/part_export/shellcommands.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/FS/FS/part_export/shellcommands.pm b/FS/FS/part_export/shellcommands.pm index 4d603cb..6fe4254 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; |