mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
a6b9b360ce
commit
cd6d919373
1 changed files with 12 additions and 12 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue