Class: Async::Container::Process::Instance

Inherits:
Notify::Pipe show all
Defined in:
lib/async/container/process.rb

Constant Summary

Constants inherited from Notify::Pipe

Notify::Pipe::NOTIFY_PIPE

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Notify::Pipe

#before_spawn, open!, #ready!, #send

Methods inherited from Notify::Client

#error!, #ready!, #reloading!, #restarting!, #status!, #stopping!

Constructor Details

#initialize(io) ⇒ Instance

Returns a new instance of Instance.



43
44
45
46
47
# File 'lib/async/container/process.rb', line 43

def initialize(io)
	super
	
	@name = nil
end

Class Method Details

.for(process) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/async/container/process.rb', line 32

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

Instance Method Details

#exec(*arguments, ready: true, **options) ⇒ Object



59
60
61
62
63
64
65
66
67
# File 'lib/async/container/process.rb', line 59

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

#nameObject



55
56
57
# File 'lib/async/container/process.rb', line 55

def name
	@name
end

#name=(value) ⇒ Object



49
50
51
52
53
# File 'lib/async/container/process.rb', line 49

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