From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B75241A1E1D for ; Mon, 12 Sep 2016 17:00:13 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 12 Sep 2016 17:00:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,325,1470726000"; d="scan'208";a="1055058851" Received: from orsmsx110.amr.corp.intel.com ([10.22.240.8]) by fmsmga002.fm.intel.com with ESMTP; 12 Sep 2016 17:00:13 -0700 Received: from orsmsx108.amr.corp.intel.com ([169.254.2.61]) by ORSMSX110.amr.corp.intel.com ([169.254.10.94]) with mapi id 14.03.0248.002; Mon, 12 Sep 2016 17:00:12 -0700 From: "Bjorge, Erik C" To: "Gao, Liming" , "edk2-devel@lists.01.org" CC: "Zhu, Yonghong" , "Kinney, Michael D" Thread-Topic: [Patch 2/4] BaseTools: Update python tool to call external tools with shell true mode Thread-Index: AQHSDQ9yo5PCLOWQAEeI2ajjWh8yF6B2iWfw Date: Tue, 13 Sep 2016 00:00:12 +0000 Message-ID: <7FE3244EBB31F1449E4EC79CFE44E3F4796FEDFE@ORSMSX108.amr.corp.intel.com> References: <1473696210-6264-1-git-send-email-liming.gao@intel.com> <1473696210-6264-3-git-send-email-liming.gao@intel.com> In-Reply-To: <1473696210-6264-3-git-send-email-liming.gao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTExYjI2NTItMzhkOS00ZGMyLWJjMWEtYWUzOWY5Y2Y4MjQyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImRFMG5ZM1NwU0lVOFE1Q29aK3dNb01tanBcL2tES1hJSnVEQmdBdmVUMWdzPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.22.254.139] MIME-Version: 1.0 Subject: Re: [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: Tue, 13 Sep 2016 00:00:14 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Erik Bjorge > -----Original Message----- > From: Gao, Liming > Sent: Monday, September 12, 2016 9:03 AM > To: edk2-devel@lists.01.org > Cc: Zhu, Yonghong ; Kinney, Michael D > ; Bjorge, Erik C > Subject: [Patch 2/4] BaseTools: Update python tool to call external > tools with shell true mode >=20 > Python tool may run from source as the dos batch files. So, update > python > code to call external tools with shell true mode. >=20 > 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(-) >=20 > 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 =3D os.path.join(OutputDir, "%s.bin" % BaseName) >=20 > try: > - PopenObject =3D subprocess.Popen([ToolPath, > + PopenObject =3D subprocess.Popen(' '.join([ToolPath, > '-o', OutputBinFileName, > '-m', OutputMapFileName, > '-q', > '-f', > - VpdFileName], > + VpdFileName]), > stdout=3Dsubprocess.PIPE, > - stderr=3D subprocess.PIPE) > + stderr=3D subprocess.PIPE, > + shell=3DTrue) > except Exception, X: > EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, > ExtraData=3D"%s" % (str(X))) > (out, error) =3D 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() !=3D 'Windows': > - Command =3D Command.split() > + Command =3D Command.split() >=20 > Proc =3D None > EndOfProcedure =3D None > try: > # launch the command > - Proc =3D Popen(Command, stdout=3DPIPE, stderr=3DPIPE, env=3Dos.e= nviron, > cwd=3DWorkingDir, bufsize=3D-1) > + Proc =3D Popen(' '.join(Command), stdout=3DPIPE, stderr=3DPIPE, > env=3Dos.environ, cwd=3DWorkingDir, bufsize=3D-1, shell=3DTrue) >=20 > # launch two threads to read the STDOUT and STDERR > EndOfProcedure =3D Event() > -- > 2.8.0.windows.1