libcmd/repl: do not clear the environment on empty reloads
If `:reload` is used with no file loaded, the environment is completely cleared. That's a surprising behavior and one of the root cause behind #50. Environment clear is only performed if there's files to reload. Change-Id: Icb014f490a83aaa4d758dbf37822db16d5bb65c1 Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
@@ -1354,6 +1354,11 @@ void NixRepl::initEnv()
|
||||
|
||||
void NixRepl::reloadFiles()
|
||||
{
|
||||
if (loaded.empty() && getValues().empty()) {
|
||||
notice("No file to reload, skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
initEnv();
|
||||
|
||||
loadFiles();
|
||||
|
||||
Reference in New Issue
Block a user