Skip to content

Commit

Permalink
Fix bug when reprinting the prompt string directly to stdout.
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverPhoenix99 committed Jul 4, 2021
1 parent 917b8ed commit 0c00c26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/pry/repl.rb
Expand Up @@ -94,7 +94,6 @@ def read
@indent.reset if pry.eval_string.empty?

current_prompt = pry.select_prompt
current_prompt = current_prompt.gsub(/(\e\[[\d;]+m)/, "\001\\1\002") if pry.config.escape_prompt

indentation = pry.config.auto_indent ? @indent.current_prefix : ''

Expand Down Expand Up @@ -171,6 +170,7 @@ def handle_read_errors
# @param [String] current_prompt The prompt to use for input.
# @return [String?] The next line of input, or `nil` on <Ctrl-D>.
def read_line(current_prompt)
current_prompt = current_prompt.gsub(/(\e\[[\d;]+m)/, "\001\\1\002") if pry.config.escape_prompt
handle_read_errors do
if coolline_available?
input.completion_proc = proc do |cool|
Expand Down
3 changes: 2 additions & 1 deletion spec/integration/cli_spec.rb
Expand Up @@ -8,8 +8,9 @@
->(*args) {
pry_dir = File.expand_path(File.join(__FILE__, '../../../lib'))

# in Windows, pretend Ansicon is available so we don't get a warning in the output
# the :err option is equivalent to 2>&1
out = IO.popen([RbConfig.ruby, "-I", pry_dir, 'bin/pry', *args, err: [:child, :out]], &:read)
out = IO.popen([{ 'ANSICON' => 'ansicon' }, RbConfig.ruby, "-I", pry_dir, 'bin/pry', *args, err: [:child, :out]], &:read)
status = $CHILD_STATUS

# Pry will emit silent garbage because of our auto indent feature.
Expand Down

0 comments on commit 0c00c26

Please sign in to comment.