forked from lix-project/lix
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).
This commit is contained in:
parent
102d3d71c0
commit
9ebe02a81e
|
@ -498,17 +498,11 @@ bool NixRepl::processLine(string line)
|
||||||
Path drvPathRaw = state->store->printStorePath(drvPath);
|
Path drvPathRaw = state->store->printStorePath(drvPath);
|
||||||
|
|
||||||
if (command == ":b") {
|
if (command == ":b") {
|
||||||
/* We could do the build in this process using buildPaths(),
|
state->store->buildPaths({DerivedPath::Built{drvPath}});
|
||||||
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);
|
auto drv = state->store->readDerivation(drvPath);
|
||||||
std::cout << std::endl << "this derivation produced the following outputs:" << std::endl;
|
logger->cout("\nThis derivation produced the following outputs:");
|
||||||
for (auto & i : drv.outputsAndOptPaths(*state->store))
|
for (auto & i : drv.outputsAndOptPaths(*state->store))
|
||||||
std::cout << fmt(" %s -> %s\n", i.first, state->store->printStorePath(*i.second.second));
|
logger->cout(" %s -> %s", i.first, state->store->printStorePath(*i.second.second));
|
||||||
} catch (ExecError &) {
|
|
||||||
}
|
|
||||||
} else if (command == ":i") {
|
} else if (command == ":i") {
|
||||||
runNix("nix-env", {"-i", drvPathRaw});
|
runNix("nix-env", {"-i", drvPathRaw});
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue