Skip to content

Commit 1c91528

Browse files
ryzokukengibfahn
andcommitted
gyp: muffle xcode-select warnings
Muffle gyp from creating xcode-select related warnings, essentially flooding the console. Co-authored-by: Gibson Fahnestock <[email protected]> Refs: nodejs/node-gyp#1370 Refs: nodejs#21520
1 parent 1849a2b commit 1c91528

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tools/gyp/pylib/gyp/xcode_emulation.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def _GetSdkVersionInfoItem(self, sdk, infoitem):
495495
# Since the CLT has no SDK paths anyway, returning None is the
496496
# most sensible route and should still do the right thing.
497497
try:
498-
return GetStdout(['xcrun', '--sdk', sdk, infoitem])
498+
return GetStdoutQuiet(['xcrun', '--sdk', sdk, infoitem])
499499
except:
500500
pass
501501

@@ -1392,7 +1392,7 @@ def XcodeVersion():
13921392
if XCODE_VERSION_CACHE:
13931393
return XCODE_VERSION_CACHE
13941394
try:
1395-
version_list = GetStdout(['xcodebuild', '-version']).splitlines()
1395+
version_list = GetStdoutQuiet(['xcodebuild', '-version']).splitlines()
13961396
# In some circumstances xcodebuild exits 0 but doesn't return
13971397
# the right results; for example, a user on 10.7 or 10.8 with
13981398
# a bogus path set via xcode-select
@@ -1442,6 +1442,17 @@ def CLTVersion():
14421442
continue
14431443

14441444

1445+
def GetStdoutQuiet(cmdlist):
1446+
"""Returns the content of standard output returned by invoking |cmdlist|.
1447+
Ignores the stderr.
1448+
Raises |GypError| if the command return with a non-zero return code."""
1449+
job = subprocess.Popen(cmdlist, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
1450+
out = job.communicate()[0]
1451+
if job.returncode != 0:
1452+
raise GypError('Error %d running %s' % (job.returncode, cmdlist[0]))
1453+
return out.rstrip('\n')
1454+
1455+
14451456
def GetStdout(cmdlist):
14461457
"""Returns the content of standard output returned by invoking |cmdlist|.
14471458
Raises |GypError| if the command return with a non-zero return code."""

0 commit comments

Comments
 (0)