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.
Files changed (3) hide show
  1. data/lib/do/server.rb +12 -13
  2. data/lib/do/version.rb +1 -1
  3. 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 do |c, success|
84
- raise "could not request pty" unless success
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
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
@@ -1,3 +1,3 @@
1
1
  module DO
2
- VERSION = "0.2.0.b" unless defined?(DO::VERSION)
2
+ VERSION = "0.2.0.c" unless defined?(DO::VERSION)
3
3
  end
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: 59
4
+ hash: 56
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
9
  - 0
10
- - b
11
- version: 0.2.0.b
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-11-28 00:00:00 +01:00
19
+ date: 2011-12-01 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency