File: shl.rb

# shl.rb

Path: | pty/shl.rb
Last Update: | Mon Nov 19 15:02:15 AUS Eastern Daylight Time 2001

old-fashioned ‘shl’ like program by A. Ito

commands:

       c        creates new shell
       C-z      suspends shell
       p        lists all shell
       0,1,...  choose shell
       q        quit

### Required files

pty

### Methods

writer

### Public Instance methods

writer()

[Source]

    # File pty/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

[Validate]