[tools] Flush stdout before reading input

The last line of output (which is not terminated by a newline) was not
showing for me when running the merge script. We can either fix it by
specifying `flush=True` at the `print` statement, or flushing before
reading user input. The latter seems more future-proof.

R=machenbach@chromium.org

Change-Id: I61cb929d2f7cdd20b3e32b9beb1653fe2d5c5791
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3676857
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80890}
This commit is contained in:
Clemens Backes 2022-05-30 11:59:39 +02:00 committed by V8 LUCI CQ
parent a9ca9f7dbc
commit 045a2b88ed

View File

@ -146,6 +146,7 @@ class SideEffectHandler(object): # pragma: no cover
return Command(cmd, args, prefix, pipe, cwd=cwd) return Command(cmd, args, prefix, pipe, cwd=cwd)
def ReadLine(self): def ReadLine(self):
sys.stdout.flush()
return sys.stdin.readline().strip() return sys.stdin.readline().strip()
def ReadURL(self, url, params=None): def ReadURL(self, url, params=None):
@ -693,8 +694,12 @@ def MakeStep(step_class=Step, number=0, state=None, config=None,
except AttributeError: except AttributeError:
message = step_class.__name__ message = step_class.__name__
return step_class(message, number=number, config=config, return step_class(
state=state, options=options, message,
number=number,
config=config,
state=state,
options=options,
handler=side_effect_handler) handler=side_effect_handler)