Method: Bio::Command.query_command_open3
- Defined in:
- lib/bio/command.rb
.query_command_open3(cmd, query = nil) ⇒ Object
Executes the program via Open3.popen3 with the query (String) given to the stain, waits the program termination, and returns the data from stdout and stderr as an array of the strings.
You would use this method only when you really need to get stderr.
Arguments:
-
(required) cmd: Array containing String objects
-
(optional) query: String
- Returns
-
Array containing 2 objects: output string (or nil) and stderr string (or nil)
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/bio/command.rb', line 323 def query_command_open3(cmd, query = nil) errorlog = nil cmd = safe_command_line_array(cmd) Open3.popen3(*cmd) do |pin, pout, perr| perr.sync = true t = Thread.start { errorlog = perr.read } begin pin.print query if query pin.close output = pout.read ensure t.join end [ output, errorlog ] end end |