diff options
author | kazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-04 06:49:07 +0000 |
---|---|---|
committer | kazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-04 06:49:07 +0000 |
commit | 5b540799bf1ae14163114b42f14fbf3cf655d4cb (patch) | |
tree | 9c89c7d31df9fd307f148b9bc5d436a5d28492d4 | |
parent | af2009a58ff668fd2b5a0a3c854ed6dc9d457579 (diff) | |
download | ruby-5b540799bf1ae14163114b42f14fbf3cf655d4cb.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
-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 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" |