From 71f5913eb9127305dc6ec63936c3c283975d86c0 Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Mon, 12 Sep 2016 15:22:49 +0800 Subject: BaseTools: Update python tool to call external tools with shell true mode 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 Reviewed-by: Yonghong Zhu Reviewed-by: Erik Bjorge --- BaseTools/Source/Python/Common/VpdInfoFile.py | 7 ++++--- BaseTools/Source/Python/build/build.py | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'BaseTools/Source') diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py index cc79ee275f..d45fb4cf03 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 be02119042..b003c67403 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -268,12 +268,13 @@ def LaunchCommand(Command, WorkingDir): if not isinstance(Command, list): if platform.system() != 'Windows': Command = Command.split() + Command = ' '.join(Command) Proc = None EndOfProcedure = None try: # launch the command - Proc = Popen(Command, stdout=PIPE, stderr=PIPE, env=os.environ, cwd=WorkingDir, bufsize=-1) + Proc = Popen(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() -- cgit v1.2.3