@@ -429,7 +429,7 @@ def _GetSdkVersionInfoItem(self, sdk, infoitem):
429429 # Since the CLT has no SDK paths anyway, returning None is the
430430 # most sensible route and should still do the right thing.
431431 try :
432- return GetStdout (['xcodebuild' , '-version' , '-sdk' , sdk , infoitem ])
432+ return GetStdoutQuiet (['xcodebuild' , '-version' , '-sdk' , sdk , infoitem ])
433433 except :
434434 pass
435435
@@ -1251,7 +1251,7 @@ def XcodeVersion():
12511251 if XCODE_VERSION_CACHE :
12521252 return XCODE_VERSION_CACHE
12531253 try :
1254- version_list = GetStdout (['xcodebuild' , '-version' ]).splitlines ()
1254+ version_list = GetStdoutQuiet (['xcodebuild' , '-version' ]).splitlines ()
12551255 # In some circumstances xcodebuild exits 0 but doesn't return
12561256 # the right results; for example, a user on 10.7 or 10.8 with
12571257 # a bogus path set via xcode-select
@@ -1301,6 +1301,17 @@ def CLTVersion():
13011301 continue
13021302
13031303
1304+ def GetStdoutQuiet (cmdlist ):
1305+ """Returns the content of standard output returned by invoking |cmdlist|.
1306+ Ignores the stderr.
1307+ Raises |GypError| if the command return with a non-zero return code."""
1308+ job = subprocess .Popen (cmdlist , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
1309+ out = job .communicate ()[0 ]
1310+ if job .returncode != 0 :
1311+ raise GypError ('Error %d running %s' % (job .returncode , cmdlist [0 ]))
1312+ return out .rstrip ('\n ' )
1313+
1314+
13041315def GetStdout (cmdlist ):
13051316 """Returns the content of standard output returned by invoking |cmdlist|.
13061317 Raises |GypError| if the command return with a non-zero return code."""
0 commit comments