mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
repl: try setting the readline output on carriage return
If the first "input" is a StringIO, so the old approach never sets the realine output, so we have to check every time.
This commit is contained in:
parent
e92ac9254a
commit
159254c176
1 changed files with 7 additions and 4 deletions
|
@ -26,10 +26,6 @@ class Pry
|
|||
if options[:target]
|
||||
@pry.push_binding options[:target]
|
||||
end
|
||||
|
||||
if readline_available? && piping?
|
||||
Readline.output = File.open('/dev/tty', 'w')
|
||||
end
|
||||
end
|
||||
|
||||
# Start the read-eval-print loop.
|
||||
|
@ -184,6 +180,7 @@ class Pry
|
|||
end
|
||||
|
||||
if readline_available?
|
||||
set_readline_output
|
||||
input_readline(current_prompt, false) # false since we'll add it manually
|
||||
elsif coolline_available?
|
||||
input_readline(current_prompt)
|
||||
|
@ -222,5 +219,11 @@ class Pry
|
|||
def piping?
|
||||
!$stdout.tty? && $stdin.tty? && !Pry::Helpers::BaseHelpers.windows?
|
||||
end
|
||||
|
||||
def set_readline_output
|
||||
@readline_output ||= if piping?
|
||||
Readline.output = File.open('/dev/tty', 'w')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue