diff options
Diffstat (limited to 'extras/exec_cgi.rb')
-rw-r--r-- | extras/exec_cgi.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/extras/exec_cgi.rb b/extras/exec_cgi.rb index 5eadef8..f718f7b 100644 --- a/extras/exec_cgi.rb +++ b/extras/exec_cgi.rb @@ -65,6 +65,7 @@ class ExecCgi ).map(&:freeze) # frozen strings are faster for Hash assignments def initialize(*args) + @env = Hash === args[0] ? args.shift : {} @args = args first = args[0] or raise ArgumentError, "need path to executable" @@ -80,7 +81,7 @@ class ExecCgi env.each { |key,val| cgi_env[key] = val if key =~ /\AHTTP_/ } pipe = MyIO.pipe errbody = pipe[0] - errbody.my_pid = Process.spawn(cgi_env, *@args, + errbody.my_pid = Process.spawn(cgi_env.merge!(@env), *@args, out: pipe[1], close_others: true) pipe[1].close pipe = pipe[0] |