Class: Mediakit::Drivers::PopenDriver
- Defined in:
- lib/mediakit/drivers.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#command(*args) ⇒ String
return command to execute.
- #parse_options(args) ⇒ Object
-
#run(*args) ⇒ String
execute command and return result.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Mediakit::Drivers::Base
Instance Method Details
#run(args) ⇒ String #run(*args) ⇒ String
return command to execute
53 54 55 56 57 |
# File 'lib/mediakit/drivers.rb', line 53 def command(*args) , rest_args = (args.dup) runner = Mediakit::Process::Runner.new() runner.build_command(bin, *rest_args) end |
#parse_options(args) ⇒ Object
59 60 61 62 |
# File 'lib/mediakit/drivers.rb', line 59 def (args) = (args.last && args.last.kind_of?(Hash)) ? args.pop : {} [, args] end |
#run(args) ⇒ String #run(*args, options) ⇒ String
execute command and return result
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/mediakit/drivers.rb', line 34 def run(*args) , rest_args = (args.dup) runner = Mediakit::Process::Runner.new() begin exit_status, stdout, stderr = runner.run(bin, *rest_args) raise(FailError, stdout + stderr) unless exit_status stdout rescue Mediakit::Process::Runner::CommandNotFoundError => e raise(ConfigurationError, "cant' find bin in #{bin}.") end end |