Class: EventMachine::ProcessWatch
- Inherits:
-
Connection
- Object
- Connection
- EventMachine::ProcessWatch
- Defined in:
- lib/em/process_watch.rb
Overview
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.
Instance Method Summary collapse
-
#pid ⇒ Object
Returns the pid that EventMachine::watch_process was originally called with.
-
#process_exited ⇒ Object
Should be redefined with the user's custom callback that will be fired when the process exits.
-
#process_forked ⇒ Object
Should be redefined with the user's custom callback that will be fired when the prcess is forked.
-
#stop_watching ⇒ Object
Discontinue monitoring of the process.
Methods inherited from Connection
#close_connection, #close_connection_after_writing, #comm_inactivity_timeout, #comm_inactivity_timeout=, #connection_completed, #detach, #error?, #get_idle_time, #get_peer_cert, #get_peername, #get_pid, #get_proxied_bytes, #get_sock_opt, #get_sockname, #get_status, #notify_readable=, #notify_readable?, #notify_writable=, #notify_writable?, #pause, #paused?, #pending_connect_timeout, #pending_connect_timeout=, #post_init, #proxy_completed, #proxy_incoming_to, #proxy_target_unbound, #reconnect, #resume, #send_data, #send_datagram, #send_file_data, #set_sock_opt, #ssl_handshake_completed, #ssl_verify_peer, #start_tls, #stop_proxying, #stream_file_data, #unbind
Instance Method Details
#pid ⇒ Object
Returns the pid that EventMachine::watch_process was originally called with.
22 23 24 |
# File 'lib/em/process_watch.rb', line 22 def pid @pid end |
#process_exited ⇒ Object
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
35 36 |
# File 'lib/em/process_watch.rb', line 35 def process_exited end |
#process_forked ⇒ Object
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.
29 30 |
# File 'lib/em/process_watch.rb', line 29 def process_forked end |
#stop_watching ⇒ Object
Discontinue monitoring of the process. This will be called automatically when a process dies. User code may call it as well.
40 41 42 |
# File 'lib/em/process_watch.rb', line 40 def stop_watching EventMachine::unwatch_pid(@signature) end |