The service driver for the Shell service. It manages the creation of new Shell::Shell and Shell::SyncShell subservices.

Usage:

  Net::SSH.start( host ) do |session|
    shell = session.shell.open

    shell.cd "/home/foo"
    shell.mkdir "-p some/long/dir"
    shell.cd "some/long/dir"
    shell.touch "foo.txt"
    shell.exit

    session.loop
  end

Or:

  Net::SSH.start( host ) do |session|
    shell = session.shell.sync

    shell.cd "/home/foo"

    out = shell.test "-e some/file.txt"
    if out.status == 0
      out = shell.cat "some/file.txt"
      puts out.stdout
    else
      puts "no such file 'some/file.txt'"
    end

  end
Methods
Public Class methods
new( log, shell_factory, sync_factory )

Create a new driver with the given logger and shell and sync factories.

    # File lib/net/ssh/service/shell/driver.rb, line 59
59:           def initialize( log, shell_factory, sync_factory )
60:             @log = log
61:             @shell_factory = shell_factory
62:             @sync_factory = sync_factory
63:           end
Public Instance methods
open( options={} )

Open a new shell, using the Shell::Shell subservice and the given options.

    # File lib/net/ssh/service/shell/driver.rb, line 67
67:           def open( options={} )
68:             pty_opts = options[:pty]
69: 
70:             @shell_factory.call( pty_opts )
71:           end
sync( options={} )

Open a new shell, using the Shell::SyncShell subservice and the given options.

    # File lib/net/ssh/service/shell/driver.rb, line 75
75:           def sync( options={} )
76:             pty_opts = options[:pty]
77: 
78:             @sync_factory.call( pty_opts )
79:           end