From 22ee199f191f43c9ed5854d8a02bf8b11a0ea633 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Oct 2024 16:19:41 +0000 Subject: [PATCH] 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 Commit-Queue: David Baron --- gclient_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gclient_utils.py b/gclient_utils.py index f123496f4..d9c01ddd8 100644 --- a/gclient_utils.py +++ b/gclient_utils.py @@ -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.