fix hang running xcat commands using ssh from MN on SN

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11215 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2011-12-12 16:25:53 +00:00
parent 294d8951ac
commit c79721e81a
3 changed files with 41 additions and 10 deletions

View File

@ -54,7 +54,7 @@ else
$cmdref->{cwd}->[0] = cwd();
# get info from files piped in as stdin
my $data;
if (($^O =~ /^linux/i) && ($ENV{'SHELL'} =~ /\/ksh$/))
if ( (($^O =~ /^linux/i) && ($ENV{'SHELL'} =~ /\/ksh$/)) || !defined($ENV{'TERM'}) )
{
my $rin="";
vec($rin,fileno(STDIN),1)=1;

View File

@ -23,11 +23,28 @@ if ($bname =~ /xcatclient/) { $cmdref->{command}->[0]=shift @ARGV; } # xcatclie
else { $cmdref->{command}->[0] = $bname; } # the cmd was sym linked to xcatclient
$cmdref->{cwd}->[0] = cwd();
if (-p STDIN) {
my $data;
while ( <STDIN> ) { $data.=$_; }
$cmdref->{stdin}->[0]=$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="";
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;
}
}
my $arg;
my @tmpargv = @ARGV;

View File

@ -17,12 +17,26 @@ 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();
if (-p STDIN) {
my $data;
while ( <STDIN> ) { $data.=$_; }
$cmdref->{stdin}->[0]=$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="";
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;
}
}
push (@{$cmdref->{arg}}, @ARGV);
foreach (keys %ENV) {