Flush stdout more often so password prompts come after explanations.

"gclient sync" on Mac occasionally requires a password for "sudo":
https://source.chromium.org/chromium/chromium/src/+/main:build/mac_toolchain.py;l=172-174;drc=a5fb630f300a1a3fdda9bb22a7ca79dd5296def2
in order to update XCode.  It attempts to print the explanation for why
the password is needed prior to the password prompt showing up.

This change flushes stdout more frequently so that the explanation will
*actually* show up before the password prompt.

Bug: 40827853
Change-Id: I840e4eb3c9a46ddfb4dbfef1faff043e25d8e694
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5903937
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
changes/37/5903937/4
L. David Baron 7 months ago committed by LUCI CQ
parent 1e4e7f1a9a
commit 22ee199f19

@ -681,6 +681,8 @@ def CheckCallAndFilter(args,
line_start = command_output.tell()
stdout_write(in_byte)
if print_stdout and is_newline:
sys.stdout.flush()
command_output.write(in_byte)
# Flush the rest of buffered output.

Loading…
Cancel
Save