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):
|
def print_with_argv0(message):
|
||||||
print(sys.argv[0] + ": " + message)
|
print(sys.argv[0] + ": " + message)
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
def quote_shell_command(args):
|
def quote_shell_command(args):
|
||||||
@@ -82,6 +83,7 @@ def check_call(args, print_command=False, verbose=False, disable_sleep=False):
|
|||||||
|
|
||||||
if print_command:
|
if print_command:
|
||||||
print(os.getcwd() + "$ " + quote_shell_command(args))
|
print(os.getcwd() + "$ " + quote_shell_command(args))
|
||||||
|
sys.stdout.flush()
|
||||||
try:
|
try:
|
||||||
return subprocess.check_call(args)
|
return subprocess.check_call(args)
|
||||||
except subprocess.CalledProcessError as e:
|
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):
|
def check_output(args, print_command=False, verbose=False):
|
||||||
if print_command:
|
if print_command:
|
||||||
print(os.getcwd() + "$ " + quote_shell_command(args))
|
print(os.getcwd() + "$ " + quote_shell_command(args))
|
||||||
|
sys.stdout.flush()
|
||||||
try:
|
try:
|
||||||
return subprocess.check_output(args)
|
return subprocess.check_output(args)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
|||||||
@@ -37,5 +37,6 @@ def print_xcodebuild_versions(file=sys.stdout):
|
|||||||
print(u'--- SDK versions ---', file=file)
|
print(u'--- SDK versions ---', file=file)
|
||||||
print(u'{}\n'.format(_output(['xcodebuild', '-version', '-sdk'])),
|
print(u'{}\n'.format(_output(['xcodebuild', '-version', '-sdk'])),
|
||||||
file=file)
|
file=file)
|
||||||
|
file.flush()
|
||||||
# You can't test beyond this because each developer's machines may have
|
# You can't test beyond this because each developer's machines may have
|
||||||
# a different set of SDKs installed.
|
# a different set of SDKs installed.
|
||||||
|
|||||||
@@ -41,10 +41,11 @@ def _print_command(dry_run, command, env=None, prompt="+ "):
|
|||||||
if env is not None:
|
if env is not None:
|
||||||
output += ['env'] + [_quote("%s=%s" % (k, v)) for k, v in env]
|
output += ['env'] + [_quote("%s=%s" % (k, v)) for k, v in env]
|
||||||
output += [_quote(arg) for arg in command]
|
output += [_quote(arg) for arg in command]
|
||||||
file = None
|
|
||||||
if not dry_run:
|
|
||||||
file = sys.stderr
|
file = sys.stderr
|
||||||
|
if dry_run:
|
||||||
|
file = sys.stdout
|
||||||
print(prompt + ' '.join(output), file=file)
|
print(prompt + ' '.join(output), file=file)
|
||||||
|
file.flush()
|
||||||
|
|
||||||
|
|
||||||
def call(command, stderr=None, env=None, dry_run=None):
|
def call(command, stderr=None, env=None, dry_run=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user