Method: Bio::Command.call_command_popen

Defined in:
lib/bio/command.rb

.call_command_popen(cmd, options = {}, &block) ⇒ Object

This method is internally called from the call_command method. In normal case, use call_command, and do not call this method directly.

Executes the program via IO.popen for OS which doesn’t support fork. A block must be given. An IO object is passed to the block.

See the document of call_command for available options.

Note for Ruby 1.8: In Ruby 1.8, although shell unsafe characters are escaped. If inescapable characters exists, it raises RuntimeError. So, call_command_fork is normally recommended.

Note for Ruby 1.9: In Ruby 1.9, call_command_popen is safe and robust enough, and is the recommended way, because IO.popen is improved to get a command-line as an array without calling shell.


Arguments:

  • (required) cmd: Array containing String objects

  • (optional) options: Hash

Returns

(undefined)



235
236
237
238
239
240
241
242
243
244
245
# File 'lib/bio/command.rb', line 235

def call_command_popen(cmd, options = {}, &block)
  if RUBY_VERSION >= "1.9.0" then
    if RUBY_ENGINE == 'jruby' then
      _call_command_popen_jruby19(cmd, options, &block)
    else
      _call_command_popen_ruby19(cmd, options, &block)
    end
  else
    _call_command_popen_ruby18(cmd, options, &block)
  end
end