diff options
Diffstat (limited to 'lib/alaveteli_external_command.rb')
-rw-r--r-- | lib/alaveteli_external_command.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/alaveteli_external_command.rb b/lib/alaveteli_external_command.rb index 79711328c..f28d00d8f 100644 --- a/lib/alaveteli_external_command.rb +++ b/lib/alaveteli_external_command.rb @@ -9,13 +9,14 @@ module AlaveteliExternalCommand # :binary_output - boolean flag for treating the output as binary or text (only significant # ruby 1.9 and above) # :memory_limit - maximum amount of memory (in bytes) available to the process + # :timeout - maximum amount of time (in s) to allow the process to run for def run(program_name, *args) # Run an external program, and return its output. # Standard error is suppressed unless the program # fails (i.e. returns a non-zero exit status). opts = {} - if !args.empty? && args[-1].is_a?(Hash) - opts = args.pop + if !args.empty? && args.last.is_a?(Hash) + opts = args.last end program_path = find_program(program_name) |