Skip to content

Commit

Permalink
Bump to version 0.2.0.c
Browse files Browse the repository at this point in the history
  • Loading branch information
DAddYE committed Dec 1, 2011
1 parent 2c7a97b commit 1e765f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
25 changes: 12 additions & 13 deletions lib/do/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def close
#
def run(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
options[:pty] = true unless options.has_key?(:pty)
cmd = args.join(" ")
if options[:as]
if options[:as] == 'root'
Expand All @@ -80,19 +81,17 @@ def run(*args)
log cmd
result = ""
ssh.open_channel do |channel|
channel.request_pty do |c, success|
raise "could not request pty" unless success
channel.exec cmd
channel.on_data do |c_, data|
result << data
DO_LOGGER.print(data) unless options[:silent]
if options[:input]
match = options[:match] || /password/i
if data =~ match
options[:input] += "\n" if options[:input][-1] != ?\n
channel.send_data(options[:input])
DO_LOGGER.puts(options[:input]) unless options[:silent] || data =~ /password/i
end
channel.request_pty if options[:input] || options[:pty]
channel.exec cmd
channel.on_data do |c, data|
result << data
DO_LOGGER.print(data) unless options[:silent]
if options[:input]
match = options[:match] || /password/i
if data =~ match
options[:input] += "\n" if options[:input][-1] != ?\n
channel.send_data(options[:input])
DO_LOGGER.puts(options[:input]) unless options[:silent] || data =~ /password/i
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/do/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module DO
VERSION = "0.2.0.b" unless defined?(DO::VERSION)
VERSION = "0.2.0.c" unless defined?(DO::VERSION)
end

0 comments on commit 1e765f6

Please sign in to comment.