fix for defect 3458311

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11217 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2011-12-12 19:54:30 +00:00
parent c79721e81a
commit dd5a09aff3
4 changed files with 30 additions and 8 deletions

View File

@ -23,12 +23,29 @@ my $bname = basename($0);
my $cmdref;
$cmdref->{command}->[0] = $bname;
$cmdref->{cwd}->[0] = cwd();
if (-p STDIN) {
my $data;
while ( <STDIN> ) { $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 ( <STDIN> ) { $data.=$_; }
$cmdref->{stdin}->[0]=$data;
}
}
else
{
if (-p STDIN) {
while ( <STDIN> ) { $data.=$_; }
$cmdref->{stdin}->[0]=$data;
}
}
Getopt::Long::Configure("posix_default");
Getopt::Long::Configure("no_gnu_compat");
Getopt::Long::Configure("bundling");

View File

@ -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);

View File

@ -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)

View File

@ -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);