Class: Aspera::Cli::Plugins::Server::LocalExecutor
- Inherits:
-
Object
- Object
- Aspera::Cli::Plugins::Server::LocalExecutor
- Defined in:
- lib/aspera/cli/plugins/server.rb
Instance Method Summary collapse
Instance Method Details
#execute(cmd, line) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/aspera/cli/plugins/server.rb', line 35 def execute(cmd, line) # concatenate arguments, enclose in double quotes cmd = cmd.map{|v|%Q("#{v}")}.join(' ') if cmd.is_a?(Array) Log.log.debug{"Executing: #{cmd} with '#{line}'"} stdout_str, stderr_str, status = Open3.capture3(cmd, stdin_data: line, binmode: true) Log.log.debug{"exec status: #{status} -> #{stderr_str}"} raise "command #{cmd} failed with code #{status.exitstatus} #{stderr_str}" unless status.success? return stdout_str end |