Async::ContainerSourceAsyncContainerForkedChildInstance

class Instance

Represents a running child process from the point of view of the child process.

Definitions

def self.for(process)

Wrap an instance around the Process instance from within the forked child.

Signature

parameter process Process

The process intance to wrap.

Implementation

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

def name= value

Set the process title to the specified value.

Signature

parameter value String

The name of the process.

Implementation

def name= value
	if @name = value
		::Process.setproctitle(@name)
	end
end

def name

The name of the process.

Signature

returns String

Implementation

def name
	@name
end

def exec(*arguments, ready: true, **options)

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.

Implementation

def exec(*arguments, ready: true, **options)
	if ready
		self.ready!(status: "(exec)")
	else
		self.before_spawn(arguments, options)
	end
	
	::Process.exec(*arguments, **options)
end