mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.Build.Step.Run: inherit build runner cwd
Right now, if you override the build root with `--build-root`, then
`Run` steps can fail to execute because of incorrect path handling in
the compiler: `std.process.Child` gets a cwd-relative path, but also has
its cwd set to the build root. The latter behavior is really weird; it
doesn't match my expectations, nor does it match how we spawn child
`zig` processes. So, this commit makes the child process inherit the
build runner's cwd, as `LazyPath.getPath2` *expects* it to.
After investigating, this behavior dates all the way back to 2017; it
was introduced in 4543413. So, there isn't any clear/documented reason
for this; it should be safe to revert, since under the modern `LazyPath`
system it is strictly a bug AFAICT.
This commit is contained in:
parent
a63f7875f4
commit
fe855691f6
1 changed files with 0 additions and 3 deletions
|
|
@ -1334,9 +1334,6 @@ fn spawnChildAndCollect(
|
|||
var child = std.process.Child.init(argv, arena);
|
||||
if (run.cwd) |lazy_cwd| {
|
||||
child.cwd = lazy_cwd.getPath2(b, &run.step);
|
||||
} else {
|
||||
child.cwd = b.build_root.path;
|
||||
child.cwd_dir = b.build_root.handle;
|
||||
}
|
||||
child.env_map = run.env_map orelse &b.graph.env_map;
|
||||
child.request_resource_usage_statistics = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue