Method: Bio::Command.query_command_fork
- Defined in:
- lib/bio/command.rb
.query_command_fork(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.
Fork (by using IO.popen(“-”)) and exec is used to execute the program.
From the view point of security, this method is recommended rather than query_command_popen.
Arguments:
-
(required) cmd: Array containing String objects
-
(optional) query: String
-
(optional) options: Hash
- Returns
-
String or nil
301 302 303 304 305 306 307 308 309 310 |
# File 'lib/bio/command.rb', line 301 def query_command_fork(cmd, query = nil, = {}) ret = nil call_command_fork(cmd, ) do |io| io.sync = true io.print query if query io.close_write ret = io.read end ret end |