diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-10-12 15:27:02 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2021-10-12 15:27:02 +0200 |
commit | 9ebe02a81e6ecb15abaa695c26b3773ce46ef155 (patch) | |
tree | 88dbcc5c343f82c14f113906a5543bd927ae01a4 /src/nix/repl.cc | |
parent | 102d3d71c0c10d7b89d60981866404d656891f66 (diff) |
nix repl: Don't build in a child process
Fixes #5356. This is a bit risky due to interrupts, but we have to
deal with those anyway (#5353).
Diffstat (limited to 'src/nix/repl.cc')
-rw-r--r-- | src/nix/repl.cc | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/nix/repl.cc b/src/nix/repl.cc index c1233ab46..fb33fc23e 100644 --- a/src/nix/repl.cc +++ b/src/nix/repl.cc @@ -498,17 +498,11 @@ bool NixRepl::processLine(string line) Path drvPathRaw = state->store->printStorePath(drvPath); if (command == ":b") { - /* We could do the build in this process using buildPaths(), - but doing it in a child makes it easier to recover from - problems / SIGINT. */ - try { - runNix("nix", {"build", "--no-link", drvPathRaw}); - auto drv = state->store->readDerivation(drvPath); - std::cout << std::endl << "this derivation produced the following outputs:" << std::endl; - for (auto & i : drv.outputsAndOptPaths(*state->store)) - std::cout << fmt(" %s -> %s\n", i.first, state->store->printStorePath(*i.second.second)); - } catch (ExecError &) { - } + state->store->buildPaths({DerivedPath::Built{drvPath}}); + auto drv = state->store->readDerivation(drvPath); + logger->cout("\nThis derivation produced the following outputs:"); + for (auto & i : drv.outputsAndOptPaths(*state->store)) + logger->cout(" %s -> %s", i.first, state->store->printStorePath(*i.second.second)); } else if (command == ":i") { runNix("nix-env", {"-i", drvPathRaw}); } else { |