aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-04-05 17:42:53 -0500
committerJack Nagel2013-04-05 17:42:53 -0500
commit14bfaf275f6a7269c72a5f6f37f5877a2b66da67 (patch)
treee0ba47fa075cb6dbbdb99aa608f70b5827893939 /Library
parentba5db2e68c3b2d5e45c2889651c8bb5f7e371ba9 (diff)
downloadhomebrew-14bfaf275f6a7269c72a5f6f37f5877a2b66da67.tar.bz2
Allow pipe fd to be inherited under Ruby 2.0
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula_installer.rb23
1 files changed, 15 insertions, 8 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 7f94b1d9e..45f684129 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -287,17 +287,24 @@ class FormulaInstaller
# I'm guessing this is not a good way to do this, but I'm no UNIX guru
ENV['HOMEBREW_ERROR_PIPE'] = write.to_i.to_s
+ args = %W[
+ nice #{RUBY_PATH}
+ -W0
+ -I #{File.dirname(__FILE__)}
+ -rbuild
+ --
+ #{f.path}
+ ].concat(build_argv)
+
+ # Ruby 2.0+ sets close-on-exec on all file descriptors except for
+ # 0, 1, and 2 by default, so we have to specify that we want the pipe
+ # to remain open in the child process.
+ args << { write => write } if RUBY_VERSION >= "2.0"
+
fork do
begin
read.close
- exec 'nice',
- RUBY_PATH,
- '-W0',
- '-I', Pathname.new(__FILE__).dirname,
- '-rbuild',
- '--',
- f.path,
- *build_argv
+ exec(*args)
rescue Exception => e
Marshal.dump(e, write)
write.close