From 3fb1d569defcea40a2ff040e41ea9bc57667203d Mon Sep 17 00:00:00 2001 From: Bruce Dawson Date: Mon, 1 Jun 2020 20:02:10 +0000 Subject: [PATCH] Fix command prompt title after update_depot_tools Windows has a bug where it sometimes doesn't reset the command prompt title when a batch file finishes executing. A simple repro is shown here: b1.bat: echo In b1 if 1 == 1 ( b2.bat ) b2.bat: echo In b2 If you run b1.bat then "b1" will stay as the title when the batch files finish running. The solution is to use "call" followed by "exit". This bug is particularly annoying when using tabs in the new Windows Terminal. By working around the bug this makes it so that the tab titles return to being useful indicators of when a batch file is completed. A previous fix of this bug (in a different batch file) can be seen in crrev.com/c/2133303. Change-Id: Id563f3102751a91f46c5b25ce610af9ec7ab240a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2225340 Reviewed-by: Edward Lesmes Commit-Queue: Bruce Dawson --- update_depot_tools.bat | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/update_depot_tools.bat b/update_depot_tools.bat index 4311f20eec..4df4d44d80 100644 --- a/update_depot_tools.bat +++ b/update_depot_tools.bat @@ -13,7 +13,9 @@ setlocal IF "%~nx0"=="update_depot_tools.bat" ( COPY /Y "%~dp0update_depot_tools.bat" "%TEMP%\update_depot_tools_tmp.bat" >nul if errorlevel 1 goto :EOF - "%TEMP%\update_depot_tools_tmp.bat" "%~dp0" %* + REM Use call/exit to avoid leaving an orphaned window title. + call "%TEMP%\update_depot_tools_tmp.bat" "%~dp0" %* + exit /b ) set DEPOT_TOOLS_DIR=%~1