Kernel.system does not recognize shell meta-characters when command is 'jruby'
------------------------------------------------------------------------------
Key: JRUBY-1170
URL: http://jira.codehaus.org/browse/JRUBY-1170
Project: JRuby
Issue Type: Bug
Components: Interpreter
Affects Versions: JRuby 1.0.0, JRuby 1.x
Environment: Mac OS X Tiger.
JRuby 1.0 and also the latest from SVN.
Reporter: Johan Holmberg
In MRI a call to Kernel.system will be passed on to system(3). And system(3)
calls sh(1) if the command string contains shell meta-characters (like for
example "<", ">" or "&"). But in JRuby it doesn't work like that now. An
example:
$ echo 'p ARGV' > foo.rb
$ jruby -e 'system "jruby foo.rb arg1 arg2 > stdout.log"'
["arg1", "arg2", ">", "stdout.log"]
$ ruby -e 'system "jruby foo.rb arg1 arg2 > stdout.log"'
$ cat stdout.log
["arg1", "arg2"]
Note that when MRI is used, the output is correctly redirected to the
"stdout.log".
I noticed that this erroneous behaviour seem to be triggered by the use of
"jruby" as command given to Kernel.system. If I instead do like this:
$ ln bin/jruby bin/yburj
and then use the command "yburj" instead, then it works better.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email