Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions compiler/llstream.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why so hacky?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it avoids duplicating whatever logic is in rstdin to tell whether readLineFromStdin is available, eg linenoise being available or not; it is future proof

Copy link
Contributor

@Clyybber Clyybber Feb 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes nightlies fail...

when hasRstdin: import rdstdin

type
TLLRepl* = proc (s: PLLStream, buf: pointer, bufLen: int): int
Expand Down Expand Up @@ -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)
Expand Down