aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-09-28 18:45:50 -0400
committerGitHub <noreply@github.com>2018-09-28 18:45:50 -0400
commit40da2c6098f3ac2e04117ff132313f2646e68d4a (patch)
treec721569662711fcc6a6769071649e0b570441445 /src
parente242f6a609eb4d8367e2bf22ce82e210df3142bb (diff)
parent779881b978e1275eef2e3b247ec0909260f4219e (diff)
downloadzig-40da2c6098f3ac2e04117ff132313f2646e68d4a.tar.gz
zig-40da2c6098f3ac2e04117ff132313f2646e68d4a.zip
Merge pull request #1599 from ziglang/zig-build-arg0
zig build: use os_self_exe_path to determine exe path not arg0
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index cdb68ec529..5c1e107362 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -394,7 +394,12 @@ int main(int argc, char **argv) {
bool no_rosegment_workaround = false;
if (argc >= 2 && strcmp(argv[1], "build") == 0) {
- const char *zig_exe_path = arg0;
+ Buf zig_exe_path_buf = BUF_INIT;
+ if ((err = os_self_exe_path(&zig_exe_path_buf))) {
+ fprintf(stderr, "Unable to determine path to zig's own executable\n");
+ return EXIT_FAILURE;
+ }
+ const char *zig_exe_path = buf_ptr(&zig_exe_path_buf);
const char *build_file = "build.zig";
bool asked_for_help = false;