aboutsummaryrefslogtreecommitdiffstats
path: root/lib/alaveteli_external_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/alaveteli_external_command.rb')
-rw-r--r--lib/alaveteli_external_command.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/alaveteli_external_command.rb b/lib/alaveteli_external_command.rb
index ac91a5867..fbdee8a62 100644
--- a/lib/alaveteli_external_command.rb
+++ b/lib/alaveteli_external_command.rb
@@ -8,6 +8,7 @@ module AlaveteliExternalCommand
# :stdin_string - stdin string to pass to the process
# :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
def run(program_name, *args)
# Run an external program, and return its output.
# Standard error is suppressed unless the program
@@ -38,6 +39,9 @@ module AlaveteliExternalCommand
if opts.has_key? :binary_output
xc.binary_mode = opts[:binary_output]
end
+ if opts.has_key? :memory_limit
+ xc.memory_limit = opts[:memory_limit]
+ end
xc.run(opts[:stdin_string] || "", opts[:env] || {})
if xc.status != 0