aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-05-16 11:09:57 +0100
committerLouise Crow <louise.crow@gmail.com>2013-05-16 11:09:57 +0100
commit4b4b92f9a1bfa5ef5828ab15e7d9abdbd288f728 (patch)
tree1e38aced05ae2dd5c0d7bbccabbc1846b3554506
parent2cfad24e21f954099ae84d782373d3bc6336db37 (diff)
parent323318c600480e15f177e01f88946b15bad2db84 (diff)
Merge remote-tracking branch 'origin/hotfix/0.9.0.3'0.9.0.3
-rw-r--r--Rakefile3
m---------commonlib0
-rw-r--r--lib/alaveteli_external_command.rb4
-rw-r--r--lib/mail_handler/mail_handler.rb3
4 files changed, 9 insertions, 1 deletions
diff --git a/Rakefile b/Rakefile
index eb9ec718b..dc500c97c 100644
--- a/Rakefile
+++ b/Rakefile
@@ -3,9 +3,12 @@
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
+
require 'rake'
require 'rake/testtask'
require 'rdoc/task'
require 'tasks/rails'
+
+Dir[File.join(File.dirname(__FILE__),'commonlib','rblib','tests','*.rake')].each { |file| load(file) }
diff --git a/commonlib b/commonlib
-Subproject d34573a26f0894c28ac118fa27c6945223fcf85
+Subproject f4b4adfc6dea2434e52633c4923ef6e2aee3f86
diff --git a/lib/alaveteli_external_command.rb b/lib/alaveteli_external_command.rb
index 24b4b1aa8..5e9a7ee83 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
diff --git a/lib/mail_handler/mail_handler.rb b/lib/mail_handler/mail_handler.rb
index 8b227b9ca..cd5abfab7 100644
--- a/lib/mail_handler/mail_handler.rb
+++ b/lib/mail_handler/mail_handler.rb
@@ -84,7 +84,8 @@ module MailHandler
tempfile.flush
default_params = { :append_to => text, :binary_output => false }
if content_type == 'application/vnd.ms-word'
- AlaveteliExternalCommand.run("wvText", tempfile.path, tempfile.path + ".txt")
+ AlaveteliExternalCommand.run("wvText", tempfile.path, tempfile.path + ".txt",
+ { :memory_limit => 536870912 } )
# Try catdoc if we get into trouble (e.g. for InfoRequestEvent 2701)
if not File.exists?(tempfile.path + ".txt")
AlaveteliExternalCommand.run("catdoc", tempfile.path, default_params)