Method: ProcessExecuter::Options::SpawnOptions#std_redirection?

Defined in:
lib/process_executer/options/spawn_options.rb

#std_redirection?(option_key, symbol, fileno) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Does option_key indicate a standard redirection such as stdin, stdout, or stderr

Parameters:

  • option_key (Symbol, Integer, IO, Array)

    the option key to be tested

  • symbol (:in, :out, :err)

    the symbol to test for

  • fileno (Integer)

    the file descriptor number to test for

Returns:

  • (Boolean)


60
61
62
63
# File 'lib/process_executer/options/spawn_options.rb', line 60

def std_redirection?(option_key, symbol, fileno)
  test = ->(key) { key == symbol || key == fileno || (key.is_a?(IO) && key.fileno == fileno) }
  test.call(option_key) || (option_key.is_a?(Array) && option_key.any? { |key| test.call(key) })
end