Method: Fork#gets

Defined in:
lib/fork.rb

#gets(*args) ⇒ String?

In the parent process: read data from the fork. In the forked process: read data from the parent. Works just like IO#gets.

Returns:

  • (String, nil)

    The data that the forked/parent process has written.



376
377
378
379
380
381
382
# File 'lib/fork.rb', line 376

def gets(*args)
  @readable_io.gets(*args)
rescue NoMethodError
  raise NotRunning, "Fork is not running yet, you must invoke #execute first." unless @pid
  raise FlagNotSpecified, "You must set the :to_fork flag when forking in order to use this" unless @readable_io
  raise
end