diff --git a/utils/SwiftBuildSupport.py b/utils/SwiftBuildSupport.py index f0373854d9a..defddc32ad2 100644 --- a/utils/SwiftBuildSupport.py +++ b/utils/SwiftBuildSupport.py @@ -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: diff --git a/utils/swift_build_support/swift_build_support/debug.py b/utils/swift_build_support/swift_build_support/debug.py index c4e1cf8092d..b6f54dc6de2 100644 --- a/utils/swift_build_support/swift_build_support/debug.py +++ b/utils/swift_build_support/swift_build_support/debug.py @@ -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. diff --git a/utils/swift_build_support/swift_build_support/shell.py b/utils/swift_build_support/swift_build_support/shell.py index 6fe933baba9..55375d26d30 100644 --- a/utils/swift_build_support/swift_build_support/shell.py +++ b/utils/swift_build_support/swift_build_support/shell.py @@ -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 + 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):