diff options
author | Dominik Picheta <dominikpicheta@gmail.com> | 2016-04-04 20:15:52 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@gmail.com> | 2016-04-04 20:15:52 +0100 |
commit | aa01c346f76716f5d4379cd0eae2d065d676d74a (patch) | |
tree | 5983b77da7a218936802a3ed8c2123e6db2e0aca /lib/impure | |
parent | 442a682c33b4f6a7557a9b032580e391286b6105 (diff) | |
download | Nim-aa01c346f76716f5d4379cd0eae2d065d676d74a.tar.gz |
Fixes #3159.
Diffstat (limited to 'lib/impure')
-rw-r--r-- | lib/impure/rdstdin.nim | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/impure/rdstdin.nim b/lib/impure/rdstdin.nim index 469bb69c5..f722a6b39 100644 --- a/lib/impure/rdstdin.nim +++ b/lib/impure/rdstdin.nim @@ -105,7 +105,8 @@ else: proc readLineFromStdin*(prompt: string): TaintedString {. tags: [ReadIOEffect, WriteIOEffect].} = var buffer = linenoise.readLine(prompt) - if isNil(buffer): quit(0) + if isNil(buffer): + raise newException(IOError, "Linenoise returned nil") result = TaintedString($buffer) if result.string.len > 0: historyAdd(buffer) @@ -114,12 +115,12 @@ else: proc readLineFromStdin*(prompt: string, line: var TaintedString): bool {. tags: [ReadIOEffect, WriteIOEffect].} = var buffer = linenoise.readLine(prompt) - if isNil(buffer): quit(0) + if isNil(buffer): + raise newException(IOError, "Linenoise returned nil") line = TaintedString($buffer) if line.string.len > 0: historyAdd(buffer) linenoise.free(buffer) - # XXX how to determine CTRL+D? result = true proc readPasswordFromStdin*(prompt: string, password: var TaintedString): |