shl.rb

Path: pty/shl.rb
Last Update: Tue Mar 13 02:04:11 -0500 2007

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

[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]

ruby-doc.org is hosted and run by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. Ruby-doc.org was created in 2002 to promote the Ruby language and to help other Ruby hackers.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.