Method: Aruba::Processes::SpawnProcess#terminate

Defined in:
lib/aruba/processes/spawn_process.rb

#terminateObject

Terminate command



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/aruba/processes/spawn_process.rb', line 264

def terminate
  return @exit_status if stopped?

  unless @process.exited?
    if @stop_signal
      # send stop signal ...
      send_signal @stop_signal
      # ... and set the exit status
      wait
    else
      begin
        @process.stop
      rescue Errno::EPERM # This can occur on MacOS
        nil
      end
    end
  end

  @exit_status = @process.exit_code

  @stdout_cache = read_temporary_output_file @stdout_file
  @stderr_cache = read_temporary_output_file @stderr_file

  @started = false

  @exit_status
end