From dd5a09aff30dec6cf4ff214131b7fd7f8b74f404 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 12 Dec 2011 19:54:30 +0000 Subject: [PATCH] fix for defect 3458311 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11217 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/updatenode | 27 ++++++++++++++++++++++----- xCAT-client/bin/xcatDBcmds | 3 ++- xCAT-client/bin/xcatclient | 5 +++-- xCAT-client/bin/xcatclientnnr | 3 +++ 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/xCAT-client/bin/updatenode b/xCAT-client/bin/updatenode index c852b67e9..44948389a 100755 --- a/xCAT-client/bin/updatenode +++ b/xCAT-client/bin/updatenode @@ -23,12 +23,29 @@ my $bname = basename($0); my $cmdref; $cmdref->{command}->[0] = $bname; $cmdref->{cwd}->[0] = cwd(); - -if (-p STDIN) { - my $data; - while ( ) { $data.=$_; } - $cmdref->{stdin}->[0]=$data; +my $data; +# allows our plugins to get the stdin of the cmd that invoked the plugin +if ( (($^O =~ /^linux/i) && ($ENV{'SHELL'} =~ /\/ksh$/)) || !defined($ENV{'TERM'}) ) +{ + my $rin=""; + my $rout; + vec($rin,fileno(STDIN),1)=1; + my $nfound=select($rout=$rin,"","",1); + if ($nfound) + { + while ( ) { $data.=$_; } + $cmdref->{stdin}->[0]=$data; + } } +else +{ + if (-p STDIN) { + while ( ) { $data.=$_; } + $cmdref->{stdin}->[0]=$data; + } +} + + Getopt::Long::Configure("posix_default"); Getopt::Long::Configure("no_gnu_compat"); Getopt::Long::Configure("bundling"); diff --git a/xCAT-client/bin/xcatDBcmds b/xCAT-client/bin/xcatDBcmds index 4020db879..81c51191d 100755 --- a/xCAT-client/bin/xcatDBcmds +++ b/xCAT-client/bin/xcatDBcmds @@ -10,7 +10,7 @@ use Cwd; use File::Basename; use xCAT::MsgUtils; use xCAT::Client; - +use strict; use Getopt::Std; my $bname = basename($0); @@ -56,6 +56,7 @@ $cmdref->{cwd}->[0] = cwd(); my $data; if ( (($^O =~ /^linux/i) && ($ENV{'SHELL'} =~ /\/ksh$/)) || !defined($ENV{'TERM'}) ) { + my $rout; my $rin=""; vec($rin,fileno(STDIN),1)=1; my $nfound=select($rout=$rin,"","",1); diff --git a/xCAT-client/bin/xcatclient b/xCAT-client/bin/xcatclient index 3f5c3c0ac..876dfd751 100755 --- a/xCAT-client/bin/xcatclient +++ b/xCAT-client/bin/xcatclient @@ -16,19 +16,20 @@ use Cwd; use File::Basename; #use Data::Dumper; use xCAT::Client; - +use strict; my $bname = basename($0); my $cmdref; if ($bname =~ /xcatclient/) { $cmdref->{command}->[0]=shift @ARGV; } # xcatclient was invoked directly and the 1st arg is cmd name that is used to locate the plugin else { $cmdref->{command}->[0] = $bname; } # the cmd was sym linked to xcatclient $cmdref->{cwd}->[0] = cwd(); - +my $data; # allows our plugins to get the stdin of the cmd that invoked the plugin if ( (($^O =~ /^linux/i) && ($ENV{'SHELL'} =~ /\/ksh$/)) || !defined($ENV{'TERM '}) ) { my $rin=""; + my $rout; vec($rin,fileno(STDIN),1)=1; my $nfound=select($rout=$rin,"","",1); if ($nfound) diff --git a/xCAT-client/bin/xcatclientnnr b/xCAT-client/bin/xcatclientnnr index df1165117..f369da9b7 100755 --- a/xCAT-client/bin/xcatclientnnr +++ b/xCAT-client/bin/xcatclientnnr @@ -11,15 +11,18 @@ use lib "$::XCATROOT/lib/perl"; use Cwd; use File::Basename; use xCAT::Client; +use strict; my $bname = basename($0); my $cmdref; if ($bname =~ /xcatclientnnr/) { $cmdref->{command}->[0]=shift @ARGV; } # xcatclientnnr was invoked directly and the 1st arg is cmd name that is used to locate the plugin else { $cmdref->{command}->[0] = $bname; } # the cmd was sym linked to xcatclientnnr $cmdref->{cwd}->[0] = cwd(); +my $data; # allows our plugins to get the stdin of the cmd that invoked the plugin if ( (($^O =~ /^linux/i) && ($ENV{'SHELL'} =~ /\/ksh$/)) || !defined($ENV{'TERM'}) ) { + my $rout; my $rin=""; vec($rin,fileno(STDIN),1)=1; my $nfound=select($rout=$rin,"","",1);