[freeside-commits] freeside/FS/FS/part_export shellcommands.pm, 1.60, 1.61

Mark Wells mark at wavetail.420.am
Wed Oct 5 22:51:02 PDT 2011


Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv3716/FS/FS/part_export

Modified Files:
	shellcommands.pm 
Log Message:
fix SSH export, from #831

Index: shellcommands.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/shellcommands.pm,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -w -d -r1.60 -r1.61
--- shellcommands.pm	3 Oct 2011 22:36:52 -0000	1.60
+++ shellcommands.pm	6 Oct 2011 05:51:00 -0000	1.61
@@ -475,12 +475,16 @@
 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;
 



More information about the freeside-commits mailing list