Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Ability to specify a default process class for a shell
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Jan 5, 2011
1 parent a4ecce7 commit 2566f50
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/net/ssh/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ class Shell
attr_reader :state
attr_reader :shell
attr_reader :processes
attr_accessor :default_process_class

def initialize(session, shell=:default)
@session = session
@shell = shell
@state = :closed
@processes = []
@when_open = []
@default_process_class = Net::SSH::Shell::Process
open
end

Expand Down Expand Up @@ -60,7 +62,8 @@ def opening?
!open? && !closed?
end

def execute(command, klass=Net::SSH::Shell::Process, &callback)
def execute(command, klass=nil, &callback)
klass ||= default_process_class
process = klass.new(self, command, callback)
process.run if processes.empty?
processes << process
Expand Down

0 comments on commit 2566f50

Please sign in to comment.