Class: Lino::Executors::Childprocess

Inherits:
Object
  • Object
show all
Defined in:
lib/lino/executors/childprocess.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



27
28
29
# File 'lib/lino/executors/childprocess.rb', line 27

def ==(other)
  self.class == other.class
end

#execute(command_line, opts = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/lino/executors/childprocess.rb', line 10

def execute(command_line, opts = {})
  process = ::ChildProcess.build(*command_line.array)

  set_output_streams(process, opts)
  set_working_directory(process, command_line.working_directory)
  set_environment(process, command_line.environment_variables)
  start_process(process, opts)

  exit_code = process.wait

  return if exit_code.zero?

  raise Lino::Errors::ExecutionError.new(
    command_line.string, exit_code
  )
end

#hashObject



33
34
35
# File 'lib/lino/executors/childprocess.rb', line 33

def hash
  self.class.hash
end