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

Commit 1d36aea

Browse files
committed
Merge branch 'mitchellh/default_process_class'
2 parents 1f4bc83 + 2566f50 commit 1d36aea

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/net/ssh/shell.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ class Shell
1111
attr_reader :state
1212
attr_reader :shell
1313
attr_reader :processes
14+
attr_accessor :default_process_class
1415

1516
def initialize(session, shell=:default)
1617
@session = session
1718
@shell = shell
1819
@state = :closed
1920
@processes = []
2021
@when_open = []
22+
@default_process_class = Net::SSH::Shell::Process
2123
open
2224
end
2325

@@ -60,7 +62,8 @@ def opening?
6062
!open? && !closed?
6163
end
6264

63-
def execute(command, klass=Net::SSH::Shell::Process, &callback)
65+
def execute(command, klass=nil, &callback)
66+
klass ||= default_process_class
6467
process = klass.new(self, command, callback)
6568
process.run if processes.empty?
6669
processes << process

0 commit comments

Comments
 (0)