Class: EventMachine::ProcessWatch

### Home Classes Methods

### In Files

- lib/em/process_watch.rb

### Parent

EventMachine::Connection

### Methods

- #pid
- #process_exited
- #process_forked
- #receive_data
- #stop_watching

### Files

- ChangeLog
- DEFERRABLES
- EPOLL
- INSTALL
- KEYBOARD
- LEGAL
- LIGHTWEIGHT_CONCURRENCY
- PURE_RUBY
- RELEASE_NOTES
- SMTP
- SPAWNED_PROCESSES
- TODO

### Class/Module Index

Quicksearch

- EventMachine
- EventMachine
- EventMachine::Channel
- EventMachine::Completion
- EventMachine::Connection
- EventMachine::DNS
- EventMachine::DNS::Request
- EventMachine::DNS::RequestIdAlreadyUsed
- EventMachine::DNS::Resolver
- EventMachine::DNS::Socket
- EventMachine::DatagramObject
- EventMachine::DefaultDeferrable
- EventMachine::Deferrable
- EventMachine::DeferrableChildProcess
- EventMachine::Error
- EventMachine::EvmaKeyboard
- EventMachine::EvmaTCPClient
- EventMachine::EvmaTCPServer
- EventMachine::EvmaUDPSocket
- EventMachine::EvmaUNIXClient
- EventMachine::EvmaUNIXServer
- EventMachine::FileNotFoundException
- EventMachine::FileStreamer
- EventMachine::FileWatch
- EventMachine::Iterator
- EventMachine::LoopbreakReader
- EventMachine::PeriodicTimer
- EventMachine::Pool
- EventMachine::ProcessWatch
- EventMachine::Protocols
- EventMachine::Protocols
- EventMachine::Protocols::HeaderAndContentProtocol
- EventMachine::Protocols::HttpClient
- EventMachine::Protocols::HttpClient2
- EventMachine::Protocols::HttpClient2::Request
- EventMachine::Protocols::LineAndTextProtocol
- EventMachine::Protocols::LineProtocol
- EventMachine::Protocols::LineText2
- EventMachine::Protocols::Memcache
- EventMachine::Protocols::Memcache::ParserError
- EventMachine::Protocols::ObjectProtocol
- EventMachine::Protocols::Postgres3
- EventMachine::Protocols::SASLauth
- EventMachine::Protocols::SASLauthclient
- EventMachine::Protocols::SmtpClient
- EventMachine::Protocols::SmtpServer
- EventMachine::Protocols::Socks4
- EventMachine::Protocols::Stomp
- EventMachine::Protocols::Stomp::Message
- EventMachine::Protocols::TcpConnectTester
- EventMachine::Queue
- EventMachine::Reactor
- EventMachine::Selectable
- EventMachine::SpawnedProcess
- EventMachine::StreamObject
- EventMachine::SystemCmd
- EventMachine::ThreadedResource
- EventMachine::TickLoop
- EventMachine::Timer
- EventMachine::UuidGenerator
- EventMachine::YieldBlockFromSpawnedProcess
- Object
- Object::EM
- Object::P
- BufferedTokenizer
- IO
- StringIO
- TestConnection

No matching classes.

# EventMachine::ProcessWatch

This is subclassed from EventMachine::Connection for use with the process monitoring API. Read the documentation on the instance methods of this class, and for a full explanation see EventMachine.watch_process.

### Constants

Cexit

  @private

Cfork

  @private

### Public Instance Methods

pid() click to toggle source

Returns the pid that EventMachine::watch_process was originally called with.

    # File lib/em/process_watch.rb, line 22
    def pid
      @pid
    end

process_exited() click to toggle source

Should be redefined with the user's custom callback that will be fired when the process exits.

stop_watching is called automatically after this callback

    # File lib/em/process_watch.rb, line 35
    def process_exited
    end

process_forked() click to toggle source

Should be redefined with the user's custom callback that will be fired when the prcess is forked.

There is currently not an easy way to get the pid of the forked child.

    # File lib/em/process_watch.rb, line 29
    def process_forked
    end

receive_data(data) click to toggle source

@private

    # File lib/em/process_watch.rb, line 12
    def receive_data(data)
      case data
      when Cfork
        process_forked
      when Cexit
        process_exited
      end
    end

stop_watching() click to toggle source

Discontinue monitoring of the process. This will be called automatically when a process dies. User code may call it as well.

    # File lib/em/process_watch.rb, line 40
    def stop_watching
      EventMachine::unwatch_pid(@signature)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.