Forum: Ruby-core [ruby-trunk - Bug #9122][Open] requiring readline in a spawned ruby process with new process group c

87e41d0d468ad56a3b07d9a6482fd6d5?d=identicon&s=25 Hemant Kumar (gnufied)
on 2013-11-18 03:04
(Received via mailing list)
Issue #9122 has been reported by gnufied (hemant kumar).

----------------------------------------
Bug #9122: requiring readline in a spawned ruby process with new process
group can hang it
https://bugs.ruby-lang.org/issues/9122

Author: gnufied (hemant kumar)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 2.0.0-p247
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


Lets say I have a program:


~> cat a.rb
require "pty"
require "io/console"
puts "Starting"

m, s = PTY.open
s.raw! # disable newline conversion.

pid = spawn("ruby using_pry.rb", chdir: '.', pgroup: true, out: m, err:
m)
at_exit { Process.kill("TERM", pid)}
Process.wait(pid)


and


~> cat b.rb
require "readline"

loop do
  puts "Hello"
  sleep(5)
end


If I run a.rb, spawned process gets hung at requiring readline. However
if I close the stdin in spawned process via in: :close this problem does
not occur. It also does not happen if I am not reassinging STDOUT of
spawned process as currently I do.
5cf8f058a4c094bb708174fb43e7a387?d=identicon&s=25 nagachika (Tomoyuki Chikanaga) (Guest)
on 2013-12-02 03:25
(Received via mailing list)
Issue #9122 has been updated by nagachika (Tomoyuki Chikanaga).

Status changed from Open to Feedback

I cannot reproduce on Mac OS X 10.9 (Mavericks).
What's your environment. Please check if it is reproducible with
2.0.0-p353 and trunk?

----------------------------------------
Bug #9122: requiring readline in a spawned ruby process with new process
group can hang it
https://bugs.ruby-lang.org/issues/9122#change-43332

Author: gnufied (hemant kumar)
Status: Feedback
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 2.0.0-p247
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


Lets say I have a program:


~> cat a.rb
require "pty"
require "io/console"
puts "Starting"

m, s = PTY.open
s.raw! # disable newline conversion.

pid = spawn("ruby using_pry.rb", chdir: '.', pgroup: true, out: m, err:
m)
at_exit { Process.kill("TERM", pid)}
Process.wait(pid)


and


~> cat b.rb
require "readline"

loop do
  puts "Hello"
  sleep(5)
end


If I run a.rb, spawned process gets hung at requiring readline. However
if I close the stdin in spawned process via in: :close this problem does
not occur. It also does not happen if I am not reassinging STDOUT of
spawned process as currently I do.
This topic is locked and can not be replied to.