Class: IO

Inherits:
Object
  • Object
show all
Defined in:
lib/multiprocessing/namedpipe.rb

Class Method Summary collapse

Class Method Details

.named_pipe(path, create = true) ⇒ Object

Raises:

  • (IOError)


3
4
5
6
7
8
9
10
11
# File 'lib/multiprocessing/namedpipe.rb', line 3

def self.named_pipe(path, create=true)
  if !File.exist?(path)&& create
    system "mkfifo #{path}"
  end
  raise IOError.new("it is not named pipe") if File.ftype(path) != "fifo"
  pout = File.open(path, "r+")
  pin = File.open(path, "w+")
  return pout, pin
end