Method: CommandExec::Process#initialize

Defined in:
lib/command_exec/process.rb

#initialize(options = {}) ⇒ Process

Create a process object

Parameters:

  • options (Hash) (defaults to: {})

    options for the process

Options Hash (options):

  • lib_logger (Logger)

    The logger which is used to output information generated by the library. The logger which is provided needs to be compatible with api of the Ruby Logger-class.

  • stderr (Array)

    content of stderr of the process

  • stdout (Array)

    content of stdout of the process

  • log_file (Array)

    content of the log file of the process

  • pid (Number, String)

    the pid of the process

  • return_code (Number, String)

    the exit status of the process

  • reason_for_failure (Array)

    the reason for failure

  • status (Symbol)

    execution was successful, failed



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/command_exec/process.rb', line 70

def initialize(options={})
  @options = {
    lib_logger: Logger.new($stderr),
    stderr: [],
    stdout: [],
    log_file: [],
    pid: nil,
    return_code: nil,
    reason_for_failure: [],
    status: :success,
    executable: nil,
  }.merge options

  @logger = @options[:lib_logger]

  @stderr = @options[:stderr]
  @stdout = @options[:stdout]
  @status = @options[:status]
  @log_file = @options[:log_file]
  @pid = @options[:pid]
  @reason_for_failure = @options[:reason_for_failure]
  @return_code = @options[:return_code]
  @executable = @options[:executable]

  @start_time = nil
  @end_time = nil
end