nix: allow whitespace characters before command in repl

Before this change, processLine always uses the first character
as the start of the line. This cause whitespaces to matter at the
beginning of the line whereas it does not matter anywhere else.

This commit trims leading white spaces of the string line so that
subsequent operations can be performed on the string without explicitly
tracking starting and ending indices of the string.
This commit is contained in:
polykernel 2022-03-20 11:39:36 -04:00
parent d9cfd853e5
commit cbcb69a39c

View file

@ -396,6 +396,7 @@ StorePath NixRepl::getDerivationPath(Value & v) {
bool NixRepl::processLine(std::string line) bool NixRepl::processLine(std::string line)
{ {
line = trim(line);
if (line == "") return true; if (line == "") return true;
_isInterrupted = false; _isInterrupted = false;