diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-02-05 07:44:19 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-05 16:44:19 +0100 |
commit | 574f61315d015033dbf20e4840a645057b0c2060 (patch) | |
tree | d6268df2b20e7729a972983763ca431d85e852ea /compiler/llstream.nim | |
parent | c6d5f0df8d34a72734f20f2cbae4919dc25060d9 (diff) | |
download | Nim-574f61315d015033dbf20e4840a645057b0c2060.tar.gz |
nim secret: support linenoise when available (#13328)
Diffstat (limited to 'compiler/llstream.nim')
-rw-r--r-- | compiler/llstream.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/llstream.nim b/compiler/llstream.nim index fffc8db48..b550716d6 100644 --- a/compiler/llstream.nim +++ b/compiler/llstream.nim @@ -12,9 +12,9 @@ import pathutils -# support '-d:useGnuReadline' for backwards compatibility: -when not defined(windows) and (defined(useGnuReadline) or defined(useLinenoise)): - import rdstdin +template imp(x) = import x +const hasRstdin = compiles(imp(rdstdin)) +when hasRstdin: import rdstdin type TLLRepl* = proc (s: PLLStream, buf: pointer, bufLen: int): int @@ -67,7 +67,7 @@ proc llStreamClose*(s: PLLStream) = of llsFile: close(s.f) -when not declared(readLineFromStdin): +when not hasRstdin: # fallback implementation: proc readLineFromStdin(prompt: string, line: var string): bool = stderr.write(prompt) |