class Async::Container::Process::Instance
Represents a running child process from the point of view of the child process.
Public Class Methods
for(process)
click to toggle source
Wrap an instance around the {Process} instance from within the forked child. @parameter process [Process] The process intance to wrap.
# File lib/async/container/process.rb, line 36 def self.for(process) instance = self.new(process.out) # The child process won't be reading from the channel: process.close_read instance.name = process.name return instance end
new(io)
click to toggle source
Calls superclass method
Async::Container::Notify::Pipe::new
# File lib/async/container/process.rb, line 47 def initialize(io) super @name = nil end
Public Instance Methods
exec(*arguments, ready: true, **options)
click to toggle source
Replace the current child process with a different one. Forwards arguments and options to {::Process.exec}. This method replaces the child process with the new executable, thus this method never returns.
# File lib/async/container/process.rb, line 69 def exec(*arguments, ready: true, **options) if ready self.ready!(status: "(exec)") if ready else self.before_spawn(arguments, options) end # TODO prefer **options... but it doesn't support redirections on < 2.7 ::Process.exec(*arguments, options) end
name()
click to toggle source
The name of the process. @returns [String]
# File lib/async/container/process.rb, line 63 def name @name end
name=(value)
click to toggle source
Set the process title to the specified value. @parameter value [String] The name of the process.
# File lib/async/container/process.rb, line 55 def name= value if @name = value ::Process.setproctitle(@name) end end