diff options
author | Shea Levy <shea@shealevy.com> | 2017-12-27T23·51-0500 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2017-12-27T23·51-0500 |
commit | 6a0dd635084213bf75c1f36bc9bc38d242096e65 (patch) | |
tree | 0770dac8fff39aa9bac16991402ede84adccc80c /src | |
parent | 25196d0d26cf4ebe68099ebb28d287177425d307 (diff) | |
parent | bd17ccf1d822ba76cdd58e9547bc18db35189c55 (diff) |
Merge branch 'fix/issue-1757' of git://github.com/dtzWill/nix
Diffstat (limited to 'src')
-rw-r--r-- | src/nix/repl.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/nix/repl.cc b/src/nix/repl.cc index 1adb816c5bf0..9216209173d9 100644 --- a/src/nix/repl.cc +++ b/src/nix/repl.cc @@ -186,7 +186,16 @@ bool NixRepl::getLine(string & input, const std::string &prompt) { char * s = linenoise(prompt.c_str()); Finally doFree([&]() { free(s); }); - if (!s) return false; + if (!s) { + switch (auto type = linenoiseKeyType()) { + case 1: // ctrl-C + return true; + case 2: // ctrl-D + return false; + default: + throw Error(format("Unexpected linenoise keytype: %1%") % type); + } + } input += s; return true; } |