Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: JRuby 1.1.1
-
Fix Version/s: None
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:MAC OS X Tiger. Java 1.5.0_07. JRuby says: "ruby 1.8.5 (2007-11-22 rev 4842) [ppc-jruby1.1b1]".
-
Number of attachments :
Description
A program started with Kernel.system does not get the same STDIN/STDOUT as JRuby had when it started. This can be shown with the following example:
$ jruby -e 'system "tty"'
not a tty <--- Note this output
$ ruby -e 'system "tty"'
/dev/ttyp1
MRI passes on its original STDOUT/STDERR to the tty(1) program. JRuby does not.
To further demonstrate this problem a simple Ruby script "is-a-tty" like below can be used:
---------- is-a-tty ---------------
#!/usr/local/bin/ruby
def report_tty(name, f)
puts "%-6s is%s a tty" % [name, f.tty? ? "" : " NOT"]
end
report_tty "STDIN", STDIN
report_tty "STDOUT", STDOUT
report_tty "STDERR", STDERR
-------------------------
If I run this with JRuby and MRI I get:
$ jruby -e 'system "./is-a-tty"'
STDIN is NOT a tty
STDOUT is NOT a tty
STDERR is NOT a tty
$ ruby -e 'system "./is-a-tty"'
STDIN is a tty
STDOUT is a tty
STDERR is a tty
Issue Links
- is depended upon by
-
JRUBY-5523
jruby's system("ls") seems to behave different than MRI
-
- is duplicated by
-
JRUBY-5523
jruby's system("ls") seems to behave different than MRI
-
-
JRUBY-5715
STDIN/STDOUT/STDERR of a process started with Kernel#exec or Kernel#system are not TTY (but with MRI it is)
-
Provided is-a-tty now works as of commit 5668. Main reported issue (calling tty from system) is not fixed however.