diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-06-22 22:43:53 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-06-23 01:32:46 +0200 |
commit | d3176ce076407ef3e63667c0436bccf8be317ae4 (patch) | |
tree | 8dcaaab834d6afa14948239e6e6c864ba025e8e6 /src/nix | |
parent | 3c48c4b4f7a8d5a7b045b9dbee1310d20ca7750b (diff) |
Fix build-remote in nix-static
'build-remote' is now executed via /proc/self/exe so it always works.
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/main.cc | 5 | ||||
-rw-r--r-- | src/nix/run.cc | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/nix/main.cc b/src/nix/main.cc index f398e3118..17c92ebc6 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -266,6 +266,11 @@ void mainWrapped(int argc, char * * argv) programPath = argv[0]; auto programName = std::string(baseNameOf(programPath)); + if (argc > 0 && std::string_view(argv[0]) == "__build-remote") { + programName = "build-remote"; + argv++; argc--; + } + { auto legacy = (*RegisterLegacyCommand::commands)[programName]; if (legacy) return legacy(argc, argv); diff --git a/src/nix/run.cc b/src/nix/run.cc index 25a8fa8d3..45d2dfd0d 100644 --- a/src/nix/run.cc +++ b/src/nix/run.cc @@ -47,7 +47,7 @@ void runProgramInStore(ref<Store> store, Strings helperArgs = { chrootHelperName, store->storeDir, store2->getRealStoreDir(), program }; for (auto & arg : args) helperArgs.push_back(arg); - execv(readLink("/proc/self/exe").c_str(), stringsToCharPtrs(helperArgs).data()); + execv(getSelfExe().value_or("nix").c_str(), stringsToCharPtrs(helperArgs).data()); throw SysError("could not execute chroot helper"); } |