From 9f8968566ad1eaff7f5f095fc3e44a028a7bcf2e Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 18 Nov 2010 09:11:14 +0000 Subject: [PATCH] fix for bug 3083477: special handle for linux ksh environment git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8201 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/xcatDBcmds | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/xCAT-client/bin/xcatDBcmds b/xCAT-client/bin/xcatDBcmds index 5fe5db01f..f9f910f48 100755 --- a/xCAT-client/bin/xcatDBcmds +++ b/xCAT-client/bin/xcatDBcmds @@ -53,12 +53,25 @@ else $cmdref->{cwd}->[0] = cwd(); # get info from files piped in as stdin -if (-p STDIN) { - my $data; - while ( ) { - $data.=$_; - } - $cmdref->{stdin}->[0]=$data; +my $data; +if (($^O =~ /^linux/i) && ($ENV{'SHELL'} =~ /\/ksh$/)) +{ + my $rin=""; + 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; + } +} } # The noderange can be specified through a noderange file # the noderange file can be a relative path,