aboutsummaryrefslogtreecommitdiffstats
path: root/sample
diff options
context:
space:
mode:
authorkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-04 06:49:07 +0000
committerkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-04 06:49:07 +0000
commit6919eb6b980fbf13ece394c7c4906e7ef2ef7bfd (patch)
tree9c89c7d31df9fd307f148b9bc5d436a5d28492d4 /sample
parent5d2409a32fb1654f5877c0704b65228aa71133c8 (diff)
downloadruby-6919eb6b980fbf13ece394c7c4906e7ef2ef7bfd.tar.gz
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
Diffstat (limited to 'sample')
-rw-r--r--sample/pty/shl.rb7
1 files changed, 4 insertions, 3 deletions
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"