Commit 3fb1d569 authored by Bruce Dawson's avatar Bruce Dawson Committed by LUCI CQ

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/+/2225340Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
parent 394c4a94
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment