xref: /aosp_15_r20/external/bazelbuild-rules_rust/util/process_wrapper/private/process_wrapper.bat (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1@ECHO OFF
2SETLOCAL enabledelayedexpansion
3
4SET command=%*
5
6:: Resolve the `${pwd}` placeholders
7SET command=!command:${pwd}=%CD%!
8
9:: Strip out the leading `--` argument.
10SET command=!command:~3!
11
12:: Find the rustc.exe argument and sanitize it's path
13for %%A in (%*) do (
14    SET arg=%%~A
15    if "!arg:~-9!"=="rustc.exe" (
16        SET sanitized=!arg:/=\!
17
18        SET command=!sanitized! !command:%%~A=!
19        goto :break
20    )
21)
22
23:break
24
25%command%
26
27:: Capture the exit code of rustc.exe
28SET exit_code=!errorlevel!
29
30:: Exit with the same exit code
31EXIT /b %exit_code%
32