Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

some file paths break in windows (e.g cat #{_file_}) #708

Closed
banister opened this Issue · 4 comments

3 participants

@banister
Owner

e.g

[12] pry(main)> $ Pry#r

From: C:/Ruby193/lib/ruby/gems/1.9.1/gems/pry-0.9.10-x86-mingw32/lib/pry/pry_ins
Number of lines: 25
Owner: Pry
Visibility: public

def r(target=TOPLEVEL_BINDING, eval_string="")
  target = Pry.binding_for(target)
  @suppress_output = false

  loop do
    begin
      # eval_string will probably be mutated by this method
      retrieve_line(eval_string, target)
    rescue CommandError, Slop::InvalidOptionError, MethodSource::SourceNotFoundE
      output.puts "Error: #{e.message}"
    end

    begin
      break if Pry::Code.complete_expression?(eval_string)
    rescue SyntaxError => e
      output.puts "SyntaxError: #{e.message.sub(/.*syntax error, */m, '')}"
      eval_string = ""
    end
  end

  @suppress_output = true if eval_string =~ /;\Z/ || eval_string.empty?

  exec_hook :after_read, eval_string, self
  eval_string
end
[13] pry(main)> _file_
=> "C:/Ruby193/lib/ruby/gems/1.9.1/gems/pry-0.9.10-x86-mingw32/lib/pry/pry_insta
nce.rb"
[14] pry(main)> cat #{_file_}
Error: Cannot open "C:/Users/Owner/Documents/GitHub/pry-exception_explorer/C" fo
r reading.
[15] pry(main)> _file_
=> "C:/Users/Owner/Documents/GitHub/pry-exception_explorer/C"
[16] pry(main)>
@envygeeks

Have cat run it through Pathname and then do Pathname#read or Pathname#binread.

@kyrylo
Collaborator

@envygeeks, sounds good. Open a pull request?

@envygeeks

@kyrylo I'll see if I can find time today to do it.

@yui-knk yui-knk referenced this issue from a commit in yui-knk/pry
@yui-knk yui-knk Fix some file paths break in Windows (#708). file_and_line methods in…
… lib/pry/commands/cat/file_formatter.rb split file path with ':'. So if file path is 'c:/path/to/file', this method works incorrectly. This fix replace ':' to regexp
4b284f9
@ghost

@yui-knk has opened a PR to address this issue #1050

@ghost ghost closed this
@ghost Unknown referenced this issue from a commit
@yui-knk yui-knk Fix some file paths break in Windows (#708). file_and_line methods in…
… lib/pry/commands/cat/file_formatter.rb split file path with ':'. So if file path is 'c:/path/to/file', this method works incorrectly. This fix replace ':' to regexp
3962b46
@strcmp strcmp referenced this issue from a commit
@yui-knk yui-knk Fix some file paths break in Windows (#708). file_and_line methods in…
… lib/pry/commands/cat/file_formatter.rb split file path with ':'. So if file path is 'c:/path/to/file', this method works incorrectly. This fix replace ':' to regexp
7fda606
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.