# std.Build.Step.Run: inherit build runner cwd · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/fe855691f6f742a14678cb617422977c2a55be39)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: fe855691f6f742a14678cb617422977c2a55be39

Requested commit: fe855691f6f742a14678cb617422977c2a55be39

Commit: fe855691f6f742a14678cb617422977c2a55be39

Tree: f97c04ea5e57d3b85d6b61612c82f0ac89db8ca5

Author: mlugg

Committer: mlugg

## Message

```
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.

```

## Parents

- [a63f7875f451bda975ddabcc0c1feed10a216516](https://git.cafe/gitcafe/zig/commit/a63f7875f451bda975ddabcc0c1feed10a216516?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/fe855691f6f742a14678cb617422977c2a55be39?format=markdown)
