Class: LiveConsole::IOMethods::UnixSocketIO

Inherits:
Object
  • Object
show all
Includes:
IOMethod
Defined in:
lib/live_console/io_methods/unix_socket_io.rb

Constant Summary collapse

DefaultOpts =
{
	:mode => 0600,
	:uid => Process.uid,
	:gid => Process.gid,
}
RequiredOpts =
DefaultOpts.keys + [:path]

Instance Method Summary collapse

Methods included from IOMethod

included, #initialize, #missing_opts, #select

Instance Method Details

#startObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/live_console/io_methods/unix_socket_io.rb', line 13

def start
	@server ||= UNIXServer.new path
	
	begin
		self.raw_input = self.raw_output = server.accept_nonblock
		raw_input.sync = true
		return true
	rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO,
		   Errno::EINTR => e
		select
		retry
	end
end

#stopObject



27
28
29
30
# File 'lib/live_console/io_methods/unix_socket_io.rb', line 27

def stop
	select
	raw_input.close
end