mirror of
https://github.com/NixOS/nix
synced 2025-06-25 02:21:16 +02:00
Merge pull request #12730 from xokdvium/repl-shell-env
libcmd/repl: Fix missing runNix in repl
This commit is contained in:
commit
ff17dd2a9a
2 changed files with 10 additions and 4 deletions
|
@ -124,7 +124,7 @@ std::string removeWhitespace(std::string s)
|
|||
|
||||
|
||||
NixRepl::NixRepl(const LookupPath & lookupPath, nix::ref<Store> store, ref<EvalState> state,
|
||||
std::function<NixRepl::AnnotatedValues()> getValues, RunNix * runNix = nullptr)
|
||||
std::function<NixRepl::AnnotatedValues()> getValues, RunNix * runNix)
|
||||
: AbstractNixRepl(state)
|
||||
, debugTraceIndex(0)
|
||||
, getValues(getValues)
|
||||
|
@ -839,9 +839,10 @@ std::unique_ptr<AbstractNixRepl> AbstractNixRepl::create(
|
|||
{
|
||||
return std::make_unique<NixRepl>(
|
||||
lookupPath,
|
||||
openStore(),
|
||||
std::move(store),
|
||||
state,
|
||||
getValues
|
||||
getValues,
|
||||
runNix
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -859,7 +860,8 @@ ReplExitStatus AbstractNixRepl::runSimple(
|
|||
lookupPath,
|
||||
openStore(),
|
||||
evalState,
|
||||
getValues
|
||||
getValues,
|
||||
/*runNix=*/nullptr
|
||||
);
|
||||
|
||||
repl->initEnv();
|
||||
|
|
|
@ -56,6 +56,10 @@ testRepl () {
|
|||
nix repl "${nixArgs[@]}" 2>&1 <<< "builtins.currentSystem" \
|
||||
| grep "$(nix-instantiate --eval -E 'builtins.currentSystem')"
|
||||
|
||||
# regression test for #12163
|
||||
replOutput=$(nix repl "${nixArgs[@]}" 2>&1 <<< ":sh import $testDir/simple.nix")
|
||||
echo "$replOutput" | grepInverse "error: Cannot run 'nix-shell'"
|
||||
|
||||
expectStderr 1 nix repl "${testDir}/simple.nix" \
|
||||
| grepQuiet -s "error: path '$testDir/simple.nix' is not a flake"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue