lib/fig/protocol/ssh.rb
# Execute command on remote host with external ssh program.
Execute command on remote host with external ssh program.
Execute command on remote host with external ssh program .
def ssh(host, *command, &error_block)
    ssh_command = ['ssh', '-n', host, *command]
    begin
      output, errors, result = Fig::ExternalProgram.capture ssh_command
    rescue Errno::ENOENT => error
      yield %Q<Could not run "#{ssh_command.join ' '}": #{error.message}.>
      return
    end
    if result && ! result.success?
      yield %Q<Could not run "#{ssh_command.join ' '}": #{result}: #{errors}>
      return
    end
    return output
  end
def ssh ( host , * command , & error_block ) ssh_command = [ 'ssh' , '-n' , host , * command ] begin output , errors , result = Fig :: ExternalProgram . capture ssh_command rescue Errno :: ENOENT => error yield %Q<Could not run "#{ssh_command.join ' '}": #{error.message}.> return end if result && ! result . success? yield %Q<Could not run "#{ssh_command.join ' '}": #{result}: #{errors}> return end return output end
Execute command on remote host with external ssh program.
Execute command on remote host with external ssh program .
host
command
error_block