lib/shexy.rb in shexy-0.3.2 vs lib/shexy.rb in shexy-0.3.3

- old
+ new

@@ -31,11 +31,11 @@ # Shexy.copy_to 'test@test-host', '/home/rubiojr/my-uber-file', '/tmp/' # module Shexy - VERSION = '0.3.2' + VERSION = '0.3.3' [:user, :password, :key, :cmd, :host].each do |n| instance_eval %{ def #{n}; Thread.current[:shexy_#{n}]; end def #{n}=(v); Thread.current[:shexy_#{n}] = v; end @@ -91,11 +91,19 @@ end self.flags[:password] = self.password if self.password self.flags[:keys] = [self.key] if self.key Net::SSH.start(self.host, self.user, self.flags) do |sh| sh.open_channel do |ch| + # + # Note, too, that when a pty is requested, user's shell configuration + # scripts (.bashrc and such) are not run by default, + # whereas they are run when a pty is not present. + # + # http://net-ssh.github.com/net-ssh/classes/Net/SSH/Connection/Channel.html#method-i-request_pty + # + # FIXME: may not be successful, warn about it + ch.request_pty if sudo? - ch.request_pty if cmd =~ /(&&|\|\||&|\|)/ self.cmd = cmd.gsub(/(&&|\|\||&|\|)/, $1 + 'sudo') end self.cmd = "sudo #{cmd}" puts "SHEXY: #{cmd}" if $DEBUG