From 5b540799bf1ae14163114b42f14fbf3cf655d4cb Mon Sep 17 00:00:00 2001 From: kazu Date: Sat, 4 Feb 2017 06:49:07 +0000 Subject: sample/pty/shl.rb: update sample * Specify frozen_string_literal: true. * Fix TypeError of raise. * Use a character literal instead of Integer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/pty/shl.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sample') diff --git a/sample/pty/shl.rb b/sample/pty/shl.rb index cdaf8d7398..d82553dd89 100644 --- a/sample/pty/shl.rb +++ b/sample/pty/shl.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # # old-fashioned 'shl' like program # by A. Ito @@ -22,15 +23,15 @@ def writer 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" -- cgit v1.2.3