aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>2022-03-28 17:57:37 +0200
committerGitHub <noreply@github.com>2022-03-28 17:57:37 +0200
commit2d572a250f5eef8bfe223c8e5196cce9e85d73f7 (patch)
tree028c080c8d0bdb701511b2832890435a3fc0fd76
parenta3f932db32d9fabd0538be1cccafc22ad0258c0b (diff)
parentb266fd53dda9c303c55ceb55752c2117011fce69 (diff)
Merge pull request #6330 from edolstra/run-remote-store
nix {run,shell}: Print a better error message if the store is not local
-rw-r--r--src/nix/run.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nix/run.cc b/src/nix/run.cc
index 033263c36..23e893fbf 100644
--- a/src/nix/run.cc
+++ b/src/nix/run.cc
@@ -38,9 +38,12 @@ void runProgramInStore(ref<Store> store,
unshare(CLONE_NEWUSER) doesn't work in a multithreaded program
(which "nix" is), so we exec() a single-threaded helper program
(chrootHelper() below) to do the work. */
- auto store2 = store.dynamic_pointer_cast<LocalStore>();
+ auto store2 = store.dynamic_pointer_cast<LocalFSStore>();
- if (store2 && store->storeDir != store2->getRealStoreDir()) {
+ if (!store2)
+ throw Error("store '%s' is not a local store so it does not support command execution", store->getUri());
+
+ if (store->storeDir != store2->getRealStoreDir()) {
Strings helperArgs = { chrootHelperName, store->storeDir, store2->getRealStoreDir(), program };
for (auto & arg : args) helperArgs.push_back(arg);