Commit a358defc authored by Bruce Dawson's avatar Bruce Dawson Committed by LUCI CQ

Revert "Update autoninja.bat to work with other shells."

This reverts commit ba352e00.

Reason for revert: Unfortunately this breaks this command when run
from a normal cmd.exe prompt:
  autoninja ..\..\base\win\access_token.cc^^
The escaping of ^^ as it passes through batch files is very finicky, but important.

Original change's description:
> Update autoninja.bat to work with other shells.
>
> Other shells, such as TCC, have subtle differences in how batch files are processed. This will not break cmd.exe compatibility.
>
> Without the "call" command, running a nested batch file should, according to CMD.exe "rules", cancel the current batch file and run the new one. However, the 'FOR /f "usebackq"' command will call the batch file and return. One could argue for both approaches, however, adding the "call" command doesn't seem to affect cmd.exe and fixes the other shell.
>
> There is a similar issue with the "do" (in the FOR command) block and the use of the '&' separator. The '%a' variable isn't expanded, but adding the '()' block works in both instances.
>
> Bug: 1351817
> Change-Id: Idd685a64404ea950b71e1f3cc0f5d1e3bf13b8b6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3824199
> Commit-Queue: Allen Bauer <kylixrd@chromium.org>
> Reviewed-by: Bruce Dawson <brucedawson@chromium.org>

Bug: 1351817
Change-Id: I9d204a3369c468664c0cff247ed1a53065dfebfd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3829729
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
parent 73cc22d4
...@@ -9,7 +9,7 @@ set scriptdir=%~dp0 ...@@ -9,7 +9,7 @@ set scriptdir=%~dp0
if not defined AUTONINJA_BUILD_ID ( if not defined AUTONINJA_BUILD_ID (
:: Set unique build ID. :: Set unique build ID.
FOR /f "usebackq tokens=*" %%a in (`call %scriptdir%python-bin\python3.bat -c "import uuid; print(uuid.uuid4())"`) do set AUTONINJA_BUILD_ID=%%a FOR /f "usebackq tokens=*" %%a in (`%scriptdir%python-bin\python3.bat -c "import uuid; print(uuid.uuid4())"`) do set AUTONINJA_BUILD_ID=%%a
) )
:: If a build performance summary has been requested then also set NINJA_STATUS :: If a build performance summary has been requested then also set NINJA_STATUS
...@@ -39,7 +39,7 @@ IF NOT "%1"=="" ( ...@@ -39,7 +39,7 @@ IF NOT "%1"=="" (
:: Don't use python3 because it doesn't work in git bash on Windows and we :: Don't use python3 because it doesn't work in git bash on Windows and we
:: should be consistent between autoninja.bat and the autoninja script used by :: should be consistent between autoninja.bat and the autoninja script used by
:: git bash. :: git bash.
FOR /f "usebackq tokens=*" %%a in (`call %scriptdir%python-bin\python3.bat %scriptdir%autoninja.py "%*"`) do (echo %%a & %%a) FOR /f "usebackq tokens=*" %%a in (`%scriptdir%python-bin\python3.bat %scriptdir%autoninja.py "%*"`) do echo %%a & %%a
@if errorlevel 1 goto buildfailure @if errorlevel 1 goto buildfailure
:: Use call to invoke python script here, because we use python via python3.bat. :: Use call to invoke python script here, because we use python via python3.bat.
......
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