diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-05 01:26:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-05 01:26:27 +0000 |
commit | 3d8e259a78ba50bb23b15a86ddea345cda3ad357 (patch) | |
tree | 5e890c7a32a61740bf289b4b928a786ef52a9027 | |
parent | b13574d3c7765c72f12056b7c5adaeda42f70b54 (diff) | |
download | ruby-3d8e259a78ba50bb23b15a86ddea345cda3ad357.tar.gz |
pty/shl.rb: update [ci skip]
* sample/pty/shl.rb: leap exited child process.
[ruby-dev:49974] [Bug #13191]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | sample/pty/shl.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sample/pty/shl.rb b/sample/pty/shl.rb index 2360d8dc4c..980748e8f5 100644 --- a/sample/pty/shl.rb +++ b/sample/pty/shl.rb @@ -61,14 +61,11 @@ $reader = Thread.new { while true print ">> " STDOUT.flush + n = nil case gets when /^c/i $shells << PTY.spawn("/bin/csh") - $r_pty,$w_pty = $shells[-1] - $reader.run - if writer == 'Exit' - $shells.pop - end + n = -1 when /^p/i $shells.each_with_index do |s, i| if s @@ -79,15 +76,18 @@ while true n = $1.to_i if $shells[n].nil? print "\##{i} doesn't exist\n" - else - $r_pty,$w_pty = $shells[n] - $reader.run - if writer == 'Exit' then - $shells[n] = nil - $shells.pop until $shells.empty? or $shells[-1] - end + n = nil end when /^q/i exit end + if n + $r_pty, $w_pty, pid = $shells[n] + $reader.run + if writer == 'Exit' then + Process.wait(pid) + $shells[n] = nil + $shells.pop until $shells.empty? or $shells[-1] + end + end end |