Top Level Namespace

Defined Under Namespace

Modules: PTY Classes: IO

Instance Method Summary collapse

Instance Method Details

#writerObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'shl.rb', line 20

def writer
  system "stty -echo raw"
  begin
    while true
      c = STDIN.getc
      if c == 26 then # C-z
        $reader.raise(nil)
        return 'Suspend'
      end
      $w_pty.print c.chr
      $w_pty.flush
    end
  rescue
    $reader.raise(nil)
    return 'Exit'
  ensure
    system "stty echo -raw"
  end
end