do 0.2.0.b → 0.2.0.c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/do/server.rb +12 -13
- data/lib/do/version.rb +1 -1
- metadata +4 -4
data/lib/do/server.rb
CHANGED
@@ -69,6 +69,7 @@ module DO
|
|
69
69
|
#
|
70
70
|
def run(*args)
|
71
71
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
72
|
+
options[:pty] = true unless options.has_key?(:pty)
|
72
73
|
cmd = args.join(" ")
|
73
74
|
if options[:as]
|
74
75
|
if options[:as] == 'root'
|
@@ -80,19 +81,17 @@ module DO
|
|
80
81
|
log cmd
|
81
82
|
result = ""
|
82
83
|
ssh.open_channel do |channel|
|
83
|
-
channel.request_pty
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
if
|
92
|
-
|
93
|
-
|
94
|
-
DO_LOGGER.puts(options[:input]) unless options[:silent] || data =~ /password/i
|
95
|
-
end
|
84
|
+
channel.request_pty if options[:input] || options[:pty]
|
85
|
+
channel.exec cmd
|
86
|
+
channel.on_data do |c, data|
|
87
|
+
result << data
|
88
|
+
DO_LOGGER.print(data) unless options[:silent]
|
89
|
+
if options[:input]
|
90
|
+
match = options[:match] || /password/i
|
91
|
+
if data =~ match
|
92
|
+
options[:input] += "\n" if options[:input][-1] != ?\n
|
93
|
+
channel.send_data(options[:input])
|
94
|
+
DO_LOGGER.puts(options[:input]) unless options[:silent] || data =~ /password/i
|
96
95
|
end
|
97
96
|
end
|
98
97
|
end
|
data/lib/do/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: do
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 56
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 0.2.0.
|
10
|
+
- c
|
11
|
+
version: 0.2.0.c
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Davide D'Agostino
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-12-01 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|