-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Issues sending input to executed commands using IRB on OS X #3783
Comments
Duplicate of #3725 We have a plan for this but it is going to be the release after next when we get a new native launcher mjruby into jruby-launcher. |
There are also issues when trying to run the code using |
@preetpalS oh sorry I missed the MacOS side of this. These are two different bugs. I will change this one to just be the MacOS behavior since #3725 covers the quoting problem with our binary launcher. |
I only changed the subject line and not the original description. If people read below your original report then they will see that this only covers the input issue and not the quoting issue. |
Thanks for revisiting this issue, I apologize for submitting this wall of text as an issue (it's easy to miss the OS X side of the issue). Were you going to reopen the issue? Also, if preferable, I can remove the portion about windows (the issue is a bit long) in the description. |
The following line of code illustrates the issue:
system 'ruby -e "puts \"What is your name?\"; puts \"Hi #{gets.strip}, nice to meet you.\""'
This line of code will not run on 64-bit JRuby on Windows but will run on 64-bit Ruby MRI on Windows (verified on version 2.3.0 but I am confident it works on version 2.2.3 as well as earlier versions). Trying to execute it, gives the following error:
uninitialized constant What (NameError)
.This line of code will work on OS X (El Capitan, JRuby 9.0.5.0), but NOT when executed through
irb
(pressing ENTER on keyboard result in^M
being printed in terminal (on MRI, pressing ENTER on keyboard sends the input to the command being executed by Kernel#system)).Environment
My OS X environment
$ java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
$ uname -a
Darwin pss-MacBook-Air 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
$ jruby -v
jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit Server VM 25.77-b03 on 1.8.0_77-b03 +jit [darwin-x86_64]
$ ruby -v
jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit Server VM 25.77-b03 on 1.8.0_77-b03 +jit [darwin-x86_64]
My Windows environment
C:>java -version
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)
C:>jruby -v
jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit Server VM 25.74-b02 on 1.8.0_74-b02 +jit [Windows 10-amd64]
C:>ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]
C:>ver
Microsoft Windows [Version 10.0.10586]
Expected Behavior
See: https://gist.github.com/preetpalS/2d24c2a10409daac5063d401b39ce798
Actual Behavior
OS X irb
Note the
^M
that appear in the example below appear when pressing ENTER on the keyboard.irb(main):001:0> system 'ruby -e "puts \"What is your name?\"; puts \"Hi #{gets.strip}, nice to meet you.\""' What is your name? Test^M^M^M^M^CIRB::Abort: abort then interrupt! from org/jruby/RubyIO.java:1436:in
write'from org/jruby/RubyIO.java:1408:in
write' from org/jruby/RubyIO.java:2545:in
write'from org/jruby/RubyKernel.java:579:in
printf' from org/jruby/RubyKernel.java:1287:in
loop'from org/jruby/RubyKernel.java:1096:in
catch' from org/jruby/RubyKernel.java:1096:in
catch'from /Users/preet/.rbenv/versions/jruby-9.0.5.0/bin/irb:13:in
<top>' irb(main):002:0> exit
Windows
`C:\test>cat test.rb
system 'ruby -e "puts "What is your name?"; puts "Hi #{gets.strip}, nice to meet you.""'
C:\test>jruby test.rb
': uninitialized constant What (NameError)-e:1:in `
C:\test>ruby test.rb
What is your name?
Test
Hi Test, nice to meet you.
C:\test>irb
irb(main):001:0> system 'ruby -e "puts "What is your name?"; puts "Hi #{gets.strip}, nice to meet you.""'
What is your name?
Preetpal
Hi Preetpal, nice to meet you.
=> true
irb(main):002:0> exit
C:\test>jirb.bat
irb(main):001:0> system 'ruby -e "puts "What is your name?"; puts "Hi #{gets.strip}, nice to meet you.""'
-e:1:in
<main>': uninitialized constant What (NameError) => false irb(main):002:0> exit
The text was updated successfully, but these errors were encountered: