libcmd: make a back-compat hack more robust
otherwise eval fails if getEvalState runs before parseInstallables runs.
Change-Id: Ia0d66dd6297212f7835c4a9b2db0fb4d9e4c9b9d
This commit is contained in:
parent
9a3e3a5560
commit
a5d02bcdf9
|
@ -214,6 +214,8 @@ void SourceExprCommand::completeInstallable(AddCompletions & completions, std::s
|
||||||
|
|
||||||
evalSettings.pureEval.override(false);
|
evalSettings.pureEval.override(false);
|
||||||
auto state = getEvalState();
|
auto state = getEvalState();
|
||||||
|
state->paths.allowedPaths.reset();
|
||||||
|
|
||||||
Expr & e = state->parseExprFromFile(
|
Expr & e = state->parseExprFromFile(
|
||||||
resolveExprPath(state->paths.checkSourcePath(lookupFileArg(*state, *file)))
|
resolveExprPath(state->paths.checkSourcePath(lookupFileArg(*state, *file)))
|
||||||
);
|
);
|
||||||
|
@ -431,7 +433,10 @@ Installables SourceExprCommand::parseInstallables(
|
||||||
throw UsageError("'--file' and '--expr' are exclusive");
|
throw UsageError("'--file' and '--expr' are exclusive");
|
||||||
|
|
||||||
// FIXME: backward compatibility hack
|
// FIXME: backward compatibility hack
|
||||||
if (file) evalSettings.pureEval.override(false);
|
if (file) {
|
||||||
|
evalSettings.pureEval.override(false);
|
||||||
|
getEvalState()->paths.allowedPaths.reset();
|
||||||
|
}
|
||||||
|
|
||||||
auto state = getEvalState();
|
auto state = getEvalState();
|
||||||
auto vFile = state->mem.allocValue();
|
auto vFile = state->mem.allocValue();
|
||||||
|
|
Loading…
Reference in a new issue