Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File#each_line doesn't accept chomp: true #2650

Closed
zofrex opened this issue Apr 30, 2022 · 3 comments
Closed

File#each_line doesn't accept chomp: true #2650

zofrex opened this issue Apr 30, 2022 · 3 comments
Assignees
Milestone

Comments

@zofrex
Copy link

zofrex commented Apr 30, 2022

Possibly similar to #2205?

> File.open('/dev/null').each_line(chomp: true).first
<internal:core> core/type.rb:104:in `coerce_to_failed': wrong argument type Hash (expected Integer) (TypeError)
	from <internal:core> core/type.rb:93:in `execute_coerce_to'
	from <internal:core> core/type.rb:85:in `coerce_to'
	from <internal:core> core/io.rb:1354:in `create_each_reader'
	from <internal:core> core/io.rb:1369:in `each'
	from <internal:core> core/enumerator.rb:103:in `each_with_block'
	from <internal:core> core/enumerator.rb:94:in `each'
	from <internal:core> core/enumerable.rb:715:in `first'
	from (irb):1:in `<top (required)>'
<internal:core> core/type.rb:91:in `execute_coerce_to': undefined method `to_int' for {:chomp=>true}:Hash (NoMethodError)
Did you mean?  to_set
               taint
	from <internal:core> core/type.rb:85:in `coerce_to'
	from <internal:core> core/io.rb:1354:in `create_each_reader'
	from <internal:core> core/io.rb:1369:in `each'
	from <internal:core> core/enumerator.rb:103:in `each_with_block'
	from <internal:core> core/enumerator.rb:94:in `each'
	from <internal:core> core/enumerable.rb:715:in `first'
	from (irb):1:in `<top (required)>'
@eregon
Copy link
Member

eregon commented May 1, 2022

@bjfish It'd be a good idea to search for getline_args in CRuby and see if TruffleRuby accepts chomp: for all such methods in CRuby to ensure we don't miss any other.

@eregon
Copy link
Member

eregon commented May 2, 2022

Actually, let's leave this one to @andrykonchin :)

@andrykonchin andrykonchin added this to the 22.2.0 milestone May 16, 2022
@andrykonchin
Copy link
Member

Fixed in b30242d, thank you for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants