Class: ChildProcess::Unix::Process

### Home Classes Methods

### In Files

- lib/childprocess/unix/process.rb

### Parent

ChildProcess::AbstractProcess

### Methods

- #exited?
- #io
- #stop
- #wait

### Class/Module Index

Quicksearch

- ChildProcess
- ChildProcess::AbstractIO
- ChildProcess::AbstractProcess
- ChildProcess::Error
- ChildProcess::InvalidEnvironmentVariable
- ChildProcess::JRuby
- ChildProcess::JRuby::IO
- ChildProcess::JRuby::Process
- ChildProcess::JRuby::Pump
- ChildProcess::LaunchError
- ChildProcess::MissingPlatformError
- ChildProcess::SubclassResponsibility
- ChildProcess::TimeoutError
- ChildProcess::Tools
- ChildProcess::Tools::Generator
- ChildProcess::Unix
- ChildProcess::Unix::ForkExecProcess
- ChildProcess::Unix::IO
- ChildProcess::Unix::Lib
- ChildProcess::Unix::Lib::Attrs
- ChildProcess::Unix::Lib::FileActions
- ChildProcess::Unix::Platform
- ChildProcess::Unix::PosixSpawnProcess
- ChildProcess::Unix::PosixSpawnProcess::Argv
- ChildProcess::Unix::PosixSpawnProcess::Envp
- ChildProcess::Unix::Process
- ChildProcess::Windows
- ChildProcess::Windows::Handle
- ChildProcess::Windows::IO
- ChildProcess::Windows::IoCounters
- ChildProcess::Windows::JobObjectBasicLimitInformation
- ChildProcess::Windows::JobObjectExtendedLimitInformation
- ChildProcess::Windows::Lib
- ChildProcess::Windows::Process
- ChildProcess::Windows::Process::Job
- ChildProcess::Windows::ProcessBuilder
- ChildProcess::Windows::ProcessInfo
- ChildProcess::Windows::SecurityAttributes
- ChildProcess::Windows::StartupInfo
- Java
- Java::JavaIo
- Java::JavaIo::FileDescriptor
- Java::SunNioCh
- Java::SunNioCh::FileChannelImpl
- FFI
- FFI::MemoryPointer

No matching classes.

# ChildProcess::Unix::Process

### Attributes

pid[R]

### Public Instance Methods

exited?() click to toggle source

    # File lib/childprocess/unix/process.rb, line 28
    def exited?
      return true if @exit_code

      assert_started
      pid, status = ::Process.waitpid2(_pid, ::Process::WNOHANG | ::Process::WUNTRACED)
      pid = nil if pid == 0 # may happen on jruby

      log(:pid => pid, :status => status)

      if pid
        set_exit_code(status)
      end

      !!pid
    end

io() click to toggle source

    # File lib/childprocess/unix/process.rb, line 6
    def io
      @io ||= Unix::IO.new
    end

stop(timeout = 3) click to toggle source

    # File lib/childprocess/unix/process.rb, line 10
    def stop(timeout = 3)
      assert_started
      send_term

      begin
        return poll_for_exit(timeout)
      rescue TimeoutError
        # try next
      end

      send_kill
      wait
    rescue Errno::ECHILD, Errno::ESRCH
      # handle race condition where process dies between timeout
      # and send_kill
      true
    end

wait() click to toggle source

    # File lib/childprocess/unix/process.rb, line 44
    def wait
      assert_started

      if exited?
        exit_code
      else
        _, status = ::Process.waitpid2 _pid
        set_exit_code(status)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.