# stage1: fix lost argv\[0\] · gitcafe/zig

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

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

Visibility: public

Requested revision: c5716715d5e7d7a5eae76df77ed538a48d22f0ba

Requested commit: c5716715d5e7d7a5eae76df77ed538a48d22f0ba

Commit: c5716715d5e7d7a5eae76df77ed538a48d22f0ba

Tree: 07ceaa9ed53b8005b1e18a793857293dd90c7bfa

Author: Michael Dusan

Committer: Andrew Kelley

## Message

```
stage1: fix lost argv[0]

- bug presented on FreeBSD when `/proc` filesystem is not mounted
- bogus `cc` was used as exename, causing incorrect executable spawn
- llvm::sys::fs::getMainExecutable() has platform-specific code
  to get exename and fallback is to use param argv0
- linux fallback is rare because `/proc` is usually mounted
- *BSD fallback is not rare because `/proc` is often not mounted
- macOS doesn't ever fallback: bug cannot present
- windows doesn't ever fallback: bug cannot present
- other Posix will always present

```

## Parents

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

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