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

Mark Wells mark at wavetail.420.am
Mon Oct 3 15:36:54 PDT 2011


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

Modified Files:
	shellcommands.pm 
Log Message:
fix stdin options on shellcommands export, from #831

Index: shellcommands.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/shellcommands.pm,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -w -d -r1.59 -r1.60
--- shellcommands.pm	15 Sep 2011 10:18:52 -0000	1.59
+++ shellcommands.pm	3 Oct 2011 22:36:52 -0000	1.60
@@ -473,13 +473,17 @@
 }
 
 sub ssh_cmd { #subroutine, not method
-  # XXX shouldn't this use $opt->{'stdin_string'} at some point?
   use Net::OpenSSH;
   my $opt = { @_ };
   my $ssh = Net::OpenSSH->new($opt->{'user'}.'@'.$opt->{'host'});
   die "Couldn't establish SSH connection: ". $ssh->error if $ssh->error;
-  my ($output, $errput) = $ssh->capture2($opt->{'command'});
+
+  my $ssh_opt = {};
+  $ssh_opt->{'stdin_data'} = $opt->{'stdin_string'}
+    if exists($opt->{'stdin_string'});
+  my ($output, $errput) = $ssh->capture2($ssh_opt, $opt->{'command'});
   die "Error running SSH command: ". $ssh->error if $ssh->error;
+
   if ($errput && $opt->{'ignored_errors'} && length($opt->{'ignored_errors'})) {
     my @ignored_errors = split('\n',$opt->{'ignored_errors'});
     foreach my $ignored_error ( @ignored_errors ) {



More information about the freeside-commits mailing list