Module: PtyCompat::ProcessStatusFromPopen3

Defined in:
lib/pty_compat/process_status_from_popen3.rb

Overview

Provide a similar interface as the Process::Status.wait one that can return the PoOpen3 last process status, so that it works the same as Ruby's native PTY interface.

Instance Method Summary collapse

Instance Method Details

#wait(pid = -1,, flags = 0) ⇒ Process::Status

Wait for the last pid to end and return the corresponding Process Status.

Parameters:

  • pid (Integer) (defaults to: -1,)

    PID to wait for

  • flags (Integer) (defaults to: 0)

    Flags

Returns:

  • (Process::Status)

    Corresponding process status



10
11
12
13
14
15
16
# File 'lib/pty_compat/process_status_from_popen3.rb', line 10

def wait(pid = -1, flags = 0)
  if pid == -1 && flags.zero? && PTY.last_wait_thr
    PTY.last_wait_thr.value
  else
    super
  end
end