ruby-changes:46402
From: usa <ko1@a...>
Date: Sun, 30 Apr 2017 22:40:15 +0900 (JST)
Subject: [ruby-changes:46402] usa:r58516 (ruby_2_3): merge revision(s) 57531, 57532, 57533, 57537: [Backport #13191]
usa 2017-04-30 22:40:08 +0900 (Sun, 30 Apr 2017) New Revision: 58516 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58516 Log: merge revision(s) 57531,57532,57533,57537: [Backport #13191] pty/shl.rb: update [ci skip] * sample/pty/shl.rb: stop writer loop when the child exited. PTY::ChildExited no longer raises asynchronously since r20298. [ruby-dev:49974] [Bug #13191] pty/shl.rb: update [ci skip] * sample/pty/shl.rb: use io/console instead of stty. [ruby-dev:49974] [Bug #13191] pty/shl.rb: update [ci skip] * sample/pty/shl.rb: do not manage array length separately. [ruby-dev:49974] [Bug #13191] pty/shl.rb: update [ci skip] * sample/pty/shl.rb: leap exited child process. [ruby-dev:49974] [Bug #13191] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/sample/pty/shl.rb branches/ruby_2_3/version.h Index: ruby_2_3/sample/pty/shl.rb =================================================================== --- ruby_2_3/sample/pty/shl.rb (revision 58515) +++ ruby_2_3/sample/pty/shl.rb (revision 58516) @@ -10,15 +10,15 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/sample/pty/shl.rb#L10 # q quit require 'pty' +require 'io/console' $shells = [] -$n_shells = 0 $r_pty = nil $w_pty = nil def writer - system "stty -echo raw" + STDIN.raw! begin while true c = STDIN.getc @@ -33,16 +33,17 @@ def writer https://github.com/ruby/ruby/blob/trunk/ruby_2_3/sample/pty/shl.rb#L33 $reader.raise(nil) return 'Exit' ensure - system "stty echo -raw" + STDIN.cooked! end end $reader = Thread.new { while true begin - next if $r_pty.nil? + Thread.stop unless $r_pty c = $r_pty.getc if c.nil? then + Thread.main.raise('Exit') Thread.stop end print c.chr @@ -59,19 +60,14 @@ $reader = Thread.new { https://github.com/ruby/ruby/blob/trunk/ruby_2_3/sample/pty/shl.rb#L60 while true print ">> " STDOUT.flush + n = nil case gets when /^c/i - $shells[$n_shells] = PTY.spawn("/bin/csh") - $r_pty,$w_pty = $shells[$n_shells] - $n_shells += 1 - $reader.run - if writer == 'Exit' - $n_shells -= 1 - $shells[$n_shells] = nil - end + $shells << PTY.spawn("/bin/csh") + n = -1 when /^p/i - for i in 0..$n_shells - unless $shells[i].nil? + $shells.each_with_index do |s, i| + if s print i,"\n" end end @@ -79,14 +75,18 @@ while true https://github.com/ruby/ruby/blob/trunk/ruby_2_3/sample/pty/shl.rb#L75 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 - 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 Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 58515) +++ ruby_2_3/version.h (revision 58516) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.5" #define RUBY_RELEASE_DATE "2017-04-30" -#define RUBY_PATCHLEVEL 305 +#define RUBY_PATCHLEVEL 306 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 4 Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 58515) +++ ruby_2_3/ChangeLog (revision 58516) @@ -1,3 +1,20 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Sun Apr 30 22:38:44 2017 Nobuyoshi Nakada <nobu@r...> + + sample/pty/shl.rb: update [ci skip] + + * sample/pty/shl.rb: stop writer loop when the child exited. + PTY::ChildExited no longer raises asynchronously since r20298. + [ruby-dev:49974] [Bug #13191] + + * sample/pty/shl.rb: use io/console instead of stty. + [ruby-dev:49974] [Bug #13191] + + * sample/pty/shl.rb: do not manage array length separately. + [ruby-dev:49974] [Bug #13191] + + * sample/pty/shl.rb: leap exited child process. + [ruby-dev:49974] [Bug #13191] + Sun Apr 30 22:35:10 2017 Nobuyoshi Nakada <nobu@r...> configure.in: use AC_SEARCH_LIBS Index: ruby_2_3 =================================================================== --- ruby_2_3 (revision 58515) +++ ruby_2_3 (revision 58516) Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r57531-57533,57537 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/