Method: Bio::Command.query_command
- Defined in:
- lib/bio/command.rb
.query_command(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.
Automatically select popen for Ruby 1.9 or Windows environment and fork for the others.
Available options:
:chdir => "path" : changes working directory to the specified path.
Arguments:
-
(required) cmd: Array containing String objects
-
(optional) query: String
-
(optional) options: Hash
- Returns
-
String or nil
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
# File 'lib/bio/command.rb', line 442 def query_command(cmd, query = nil, = {}) if RUBY_VERSION >= "1.9.0" then return query_command_popen(cmd, query, ) elsif no_fork? then query_command_popen(cmd, query, ) else begin query_command_fork(cmd, query, ) rescue NotImplementedError # fork(2) not implemented @@no_fork = true query_command_fork(cmd, query, ) end end end |