diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-30 11:38:03 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-30 11:38:03 +0000 |
commit | 188ae0dbb13022332db52f65f2c5c6a8e54d77e1 (patch) | |
tree | b5dfdba2395481a24908bcf967859d51aaff829a /sample | |
parent | 37cce5ae90e8d5c78dba4b8a273e8ba4b6d79ebb (diff) |
merge revision(s) 57530: [Backport #13191]
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/branches/ruby_2_3@59228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r-- | sample/pty/shl.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sample/pty/shl.rb b/sample/pty/shl.rb index 7bddf7c1ac..980748e8f5 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 STDIN.cooked! |