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

Commit

Permalink
Merge branch 'mitchellh/default_process_class'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamis committed Jan 7, 2011
2 parents 1f4bc83 + 2566f50 commit 1d36aea
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 1d36aea

Please sign in to comment.