mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-09 06:23:25 +00:00
Fixes #3159.
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user