ruby-changes:45457
From: kazu <ko1@a...>
Date: Sat, 4 Feb 2017 15:58:57 +0900 (JST)
Subject: [ruby-changes:45457] kazu:r57530 (trunk): sample/pty/shl.rb: update sample
kazu 2017-02-04 15:49:07 +0900 (Sat, 04 Feb 2017) New Revision: 57530 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57530 Log: sample/pty/shl.rb: update sample * Specify frozen_string_literal: true. * Fix TypeError of raise. * Use a character literal instead of Integer. Modified files: trunk/sample/pty/shl.rb Index: sample/pty/shl.rb =================================================================== --- sample/pty/shl.rb (revision 57529) +++ sample/pty/shl.rb (revision 57530) @@ -1,3 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/sample/pty/shl.rb#L1 +# frozen_string_literal: true # # old-fashioned 'shl' like program # by A. Ito @@ -22,15 +23,15 @@ def writer https://github.com/ruby/ruby/blob/trunk/sample/pty/shl.rb#L23 begin while true c = STDIN.getc - if c == 26 then # C-z - $reader.raise(nil) + if c == ?\C-z then + $reader.raise('Suspend') return 'Suspend' end $w_pty.print c.chr $w_pty.flush end rescue - $reader.raise(nil) + $reader.raise('Exit') return 'Exit' ensure system "stty echo -raw" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/