diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-23 07:50:10 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-23 07:50:10 +0000 |
commit | fffc133db1c5d6b4309f80ed28e7e7364ac90801 (patch) | |
tree | b99af7474e9b1702d0070e5f905c85563aa37c26 /sample | |
parent | 873c37ce4f2a2f0a79053c68d78934338573897d (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_4@59404 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! |