From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9EC411A1E0A for ; Mon, 12 Sep 2016 09:05:05 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP; 12 Sep 2016 09:05:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,323,1470726000"; d="scan'208";a="7595430" Received: from shwde7172.ccr.corp.intel.com ([10.239.9.23]) by orsmga005.jf.intel.com with ESMTP; 12 Sep 2016 09:05:03 -0700 From: Liming Gao To: edk2-devel@lists.01.org Cc: Yonghong Zhu , Michael Kinney , Erik Bjorge Date: Tue, 13 Sep 2016 00:03:28 +0800 Message-Id: <1473696210-6264-3-git-send-email-liming.gao@intel.com> X-Mailer: git-send-email 2.8.0.windows.1 In-Reply-To: <1473696210-6264-1-git-send-email-liming.gao@intel.com> References: <1473696210-6264-1-git-send-email-liming.gao@intel.com> Subject: [Patch 2/4] BaseTools: Update python tool to call external tools with shell true mode X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 16:05:05 -0000 Python tool may run from source as the dos batch files. So, update python code to call external tools with shell true mode. Cc: Yonghong Zhu Cc: Michael Kinney Cc: Erik Bjorge Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao --- BaseTools/Source/Python/Common/VpdInfoFile.py | 7 ++++--- BaseTools/Source/Python/build/build.py | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py index cc79ee2..d45fb4c 100644 --- a/BaseTools/Source/Python/Common/VpdInfoFile.py +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py @@ -233,14 +233,15 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName): OutputBinFileName = os.path.join(OutputDir, "%s.bin" % BaseName) try: - PopenObject = subprocess.Popen([ToolPath, + PopenObject = subprocess.Popen(' '.join([ToolPath, '-o', OutputBinFileName, '-m', OutputMapFileName, '-q', '-f', - VpdFileName], + VpdFileName]), stdout=subprocess.PIPE, - stderr= subprocess.PIPE) + stderr= subprocess.PIPE, + shell=True) except Exception, X: EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData="%s" % (str(X))) (out, error) = PopenObject.communicate() diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index be02119..20f726f 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -266,14 +266,13 @@ def LaunchCommand(Command, WorkingDir): # ubuntu may fail with an error message that the command is not found. # So here we may need convert command from string to list instance. if not isinstance(Command, list): - if platform.system() != 'Windows': - Command = Command.split() + Command = Command.split() Proc = None EndOfProcedure = None try: # launch the command - Proc = Popen(Command, stdout=PIPE, stderr=PIPE, env=os.environ, cwd=WorkingDir, bufsize=-1) + Proc = Popen(' '.join(Command), stdout=PIPE, stderr=PIPE, env=os.environ, cwd=WorkingDir, bufsize=-1, shell=True) # launch two threads to read the STDOUT and STDERR EndOfProcedure = Event() -- 2.8.0.windows.1