mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[build-script] Flush immediately after print() in Python
This commit is contained in:
committed by
Rintaro Ishizaki
parent
5ea4efb147
commit
e74ebd5839
@@ -67,6 +67,7 @@ SWIFT_BUILD_ROOT = os.environ.get(
|
||||
|
||||
def print_with_argv0(message):
|
||||
print(sys.argv[0] + ": " + message)
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
def quote_shell_command(args):
|
||||
@@ -82,6 +83,7 @@ def check_call(args, print_command=False, verbose=False, disable_sleep=False):
|
||||
|
||||
if print_command:
|
||||
print(os.getcwd() + "$ " + quote_shell_command(args))
|
||||
sys.stdout.flush()
|
||||
try:
|
||||
return subprocess.check_call(args)
|
||||
except subprocess.CalledProcessError as e:
|
||||
@@ -101,6 +103,7 @@ def check_call(args, print_command=False, verbose=False, disable_sleep=False):
|
||||
def check_output(args, print_command=False, verbose=False):
|
||||
if print_command:
|
||||
print(os.getcwd() + "$ " + quote_shell_command(args))
|
||||
sys.stdout.flush()
|
||||
try:
|
||||
return subprocess.check_output(args)
|
||||
except subprocess.CalledProcessError as e:
|
||||
|
||||
@@ -37,5 +37,6 @@ def print_xcodebuild_versions(file=sys.stdout):
|
||||
print(u'--- SDK versions ---', file=file)
|
||||
print(u'{}\n'.format(_output(['xcodebuild', '-version', '-sdk'])),
|
||||
file=file)
|
||||
file.flush()
|
||||
# You can't test beyond this because each developer's machines may have
|
||||
# a different set of SDKs installed.
|
||||
|
||||
@@ -41,10 +41,11 @@ def _print_command(dry_run, command, env=None, prompt="+ "):
|
||||
if env is not None:
|
||||
output += ['env'] + [_quote("%s=%s" % (k, v)) for k, v in env]
|
||||
output += [_quote(arg) for arg in command]
|
||||
file = None
|
||||
if not dry_run:
|
||||
file = sys.stderr
|
||||
if dry_run:
|
||||
file = sys.stdout
|
||||
print(prompt + ' '.join(output), file=file)
|
||||
file.flush()
|
||||
|
||||
|
||||
def call(command, stderr=None, env=None, dry_run=None):
|
||||
|
||||
Reference in New Issue
Block a user