summary refs log tree commit diff stats
path: root/lib/impure
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@gmail.com>2016-04-04 20:15:52 +0100
committerDominik Picheta <dominikpicheta@gmail.com>2016-04-04 20:15:52 +0100
commitaa01c346f76716f5d4379cd0eae2d065d676d74a (patch)
tree5983b77da7a218936802a3ed8c2123e6db2e0aca /lib/impure
parent442a682c33b4f6a7557a9b032580e391286b6105 (diff)
downloadNim-aa01c346f76716f5d4379cd0eae2d065d676d74a.tar.gz
Fixes #3159.
Diffstat (limited to 'lib/impure')
-rw-r--r--lib/impure/rdstdin.nim7
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):