Method: Bio::Command.query_command_popen

Defined in:
lib/bio/command.rb

.query_command_popen(cmd, query = nil, options = {}) ⇒ Object

Executes the program with the query (String) given to the standard input, waits the program termination, and returns the output data printed to the standard output as a string.

IO.popen is used for OS which doesn’t support fork.


Arguments:

  • (required) cmd: Array containing String objects

  • (optional) query: String

  • (optional) options: Hash

Returns

String or nil



275
276
277
278
279
280
281
282
283
284
# File 'lib/bio/command.rb', line 275

def query_command_popen(cmd, query = nil, options = {})
  ret = nil
  call_command_popen(cmd, options) do |io|
    io.sync = true
    io.print query if query
    io.close_write
    ret = io.read
  end
  ret
end