[utils] Inline caffeinate logic into sole client.

- This eliminates the last client of `SwiftBuildSupport.check_call`, which is
   now replaced by `swift_build_support.shell.call`.

 - Part of SR-237.
This commit is contained in:
Daniel Dunbar
2016-06-01 22:42:38 -07:00
parent 87a17001cc
commit 3d06deefe4
2 changed files with 17 additions and 27 deletions

View File

@@ -18,7 +18,6 @@ except ImportError:
import configparser as ConfigParser
import os
import platform
import subprocess
import sys
@@ -70,28 +69,6 @@ SWIFT_BUILD_ROOT = os.environ.get(
"SWIFT_BUILD_ROOT", os.path.join(SWIFT_SOURCE_ROOT, "build"))
def check_call(args, print_command=False, verbose=False, disable_sleep=False):
if disable_sleep:
if platform.system() == 'Darwin':
# Don't mutate the caller's copy of the arguments.
args = list(args)
args.insert(0, "caffeinate")
if print_command:
print(os.getcwd() + "$ " + shell.quote_command(args))
sys.stdout.flush()
try:
return subprocess.check_call(args)
except subprocess.CalledProcessError as e:
diagnostics.fatal(
"command terminated with a non-zero exit status " +
str(e.returncode) + ", aborting")
except OSError as e:
diagnostics.fatal(
"could not execute '" + shell.quote_command(args) +
"': " + e.strerror)
def check_output(args, print_command=False, verbose=False):
if print_command:
print(os.getcwd() + "$ " + shell.quote_command(args))