forked from bazelbuild/rules_rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess_wrapper.bat
More file actions
executable file
·40 lines (30 loc) · 1.03 KB
/
process_wrapper.bat
File metadata and controls
executable file
·40 lines (30 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@ECHO OFF
SETLOCAL enabledelayedexpansion
SET command=%*
:: Resolve the `${pwd}` placeholders
SET command=!command:${pwd}=%CD%!
:: Resolve the `${output_base}` and `${exec_root}` placeholders.
:: The external directory is a junction/symlink to output_base\external.
:: This mirrors the logic in options.rs used by the real process wrapper.
FOR /F "delims=" %%i IN ('cd external\.. ^& cd') DO SET output_base=%%i
FOR %%i IN ("%CD%") DO SET workspace_name=%%~nxi
SET exec_root=!output_base!\execroot\!workspace_name!
SET command=!command:${output_base}=%output_base%!
SET command=!command:${exec_root}=%exec_root%!
:: Strip out the leading `--` argument.
SET command=!command:~3!
:: Find the rustc.exe argument and sanitize it's path
for %%A in (%*) do (
SET arg=%%~A
if "!arg:~-9!"=="rustc.exe" (
SET sanitized=!arg:/=\!
SET command=!sanitized! !command:%%~A=!
goto :break
)
)
:break
%command%
:: Capture the exit code of rustc.exe
SET exit_code=!errorlevel!
:: Exit with the same exit code
EXIT /b %exit_code%