Sha256: 0afd0c7fa8f5d158f7ce0a5ed86aae9c6e1dd9305b1ed715167d789fb45e1b14
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
module Net module SSH class SessionCommand attr_reader :command, :duration attr_accessor :output, :exit_code attr_accessor :start_time, :finish_time # Initialize a new session command # # @param [String] original command # @param [String] command execution output # @param [Integer] command execution exit code # @param [Float] execution time in seconds def initialize(command, output=nil, exit_code=nil, duration=0) @command = command @output = output || '' @exit_code = Integer(exit_code) rescue 1 if exit_code != nil @duration = Float(duration) end # Check if exit code is successful # @return [Boolean] def success? exit_code == 0 end # Check if exit code is not successful # @return [Boolean] def failure? exit_code != 0 end alias :error? :failure? # Get command string representation # @return [String] def to_s "[#{command}] => #{exit_code}, #{output.to_s.bytesize} bytes, #{duration} seconds" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
net-ssh-session-0.1.2 | lib/net/ssh/session_command.rb |
net-ssh-session-0.1.1 | lib/net/ssh/session_command.rb |