[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:
parent
a9ca9f7dbc
commit
045a2b88ed
@ -114,15 +114,15 @@ def Command(cmd, args="", prefix="", pipe=True, cwd=None):
|
||||
|
||||
|
||||
def SanitizeVersionTag(tag):
|
||||
version_without_prefix = re.compile(r"^\d+\.\d+\.\d+(?:\.\d+)?$")
|
||||
version_with_prefix = re.compile(r"^tags\/\d+\.\d+\.\d+(?:\.\d+)?$")
|
||||
version_without_prefix = re.compile(r"^\d+\.\d+\.\d+(?:\.\d+)?$")
|
||||
version_with_prefix = re.compile(r"^tags\/\d+\.\d+\.\d+(?:\.\d+)?$")
|
||||
|
||||
if version_without_prefix.match(tag):
|
||||
return tag
|
||||
elif version_with_prefix.match(tag):
|
||||
return tag[len("tags/"):]
|
||||
else:
|
||||
return None
|
||||
if version_without_prefix.match(tag):
|
||||
return tag
|
||||
elif version_with_prefix.match(tag):
|
||||
return tag[len("tags/"):]
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def NormalizeVersionTags(version_tags):
|
||||
@ -146,6 +146,7 @@ class SideEffectHandler(object): # pragma: no cover
|
||||
return Command(cmd, args, prefix, pipe, cwd=cwd)
|
||||
|
||||
def ReadLine(self):
|
||||
sys.stdout.flush()
|
||||
return sys.stdin.readline().strip()
|
||||
|
||||
def ReadURL(self, url, params=None):
|
||||
@ -238,7 +239,7 @@ class GitInterface(VCInterface):
|
||||
self.step.Git("fetch")
|
||||
|
||||
def GetTags(self):
|
||||
return self.step.Git("tag").strip().splitlines()
|
||||
return self.step.Git("tag").strip().splitlines()
|
||||
|
||||
def GetBranches(self):
|
||||
# Get relevant remote branches, e.g. "branch-heads/3.25".
|
||||
@ -684,18 +685,22 @@ class UploadStep(Step):
|
||||
|
||||
def MakeStep(step_class=Step, number=0, state=None, config=None,
|
||||
options=None, side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER):
|
||||
# Allow to pass in empty dictionaries.
|
||||
state = state if state is not None else {}
|
||||
config = config if config is not None else {}
|
||||
# Allow to pass in empty dictionaries.
|
||||
state = state if state is not None else {}
|
||||
config = config if config is not None else {}
|
||||
|
||||
try:
|
||||
message = step_class.MESSAGE
|
||||
except AttributeError:
|
||||
message = step_class.__name__
|
||||
try:
|
||||
message = step_class.MESSAGE
|
||||
except AttributeError:
|
||||
message = step_class.__name__
|
||||
|
||||
return step_class(message, number=number, config=config,
|
||||
state=state, options=options,
|
||||
handler=side_effect_handler)
|
||||
return step_class(
|
||||
message,
|
||||
number=number,
|
||||
config=config,
|
||||
state=state,
|
||||
options=options,
|
||||
handler=side_effect_handler)
|
||||
|
||||
|
||||
class ScriptsBase(object):
|
||||
|
Loading…
Reference in New Issue
Block a user