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

JRuby removes double quotes from commands executed on 64-bit Windows #3788

Open
preetpalS opened this issue Apr 9, 2016 · 0 comments
Open

Comments

@preetpalS
Copy link

Here an example (command prompt session) on Windows where JRuby is removing double quotes from strings before executing them through Kernel#system (which deviates from the behavior on CRuby):

C:\test>file test.rb
 test.rb: ASCII text, with CRLF line terminators

C:\test>type test.rb

system "echo \"Hi\""

C:\test>ruby -v
 ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]

C:\test>ruby test.rb
 "Hi"

C:\test>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:\test>jruby test.rb
 Hi

C:\test>echo "Hi"
 "Hi"

C:\test>echo Hi
 Hi

C:\test>

I believe that this could cause problems on Windows (especially since files and folders with spaces need to be enclosed in double quotes when not escaping spaces individually (especially when using fully qualified names)). For example, I personally have a small ruby script that I use to back up and restore PostgreSQL databases that would not work on JRuby like it does on CRuby due to this behavior (https://gist.github.com/preetpalS/025c878a0d200842fc22 (method on line 80 is affected)) although I have a workaround of just printing the system commands out so I that can copy and paste them.

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

No branches or pull requests

1 participant