浏览代码

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>
L. David Baron 10 月之前
父节点
当前提交
22ee199f19
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      gclient_utils.py

+ 2 - 0
gclient_utils.py

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