diff options
| author | Jack Nagel | 2013-04-05 17:42:53 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-04-05 17:42:53 -0500 |
| commit | 9f9608e6c570ecadf3db0112791b0f3e74a40335 (patch) | |
| tree | aca6e8fef5d349b90217e1070b37775ec9455dcb /Library | |
| parent | 62d25f9c8bb8f0471394bc6dad5d82abb163e1cb (diff) | |
| download | brew-9f9608e6c570ecadf3db0112791b0f3e74a40335.tar.bz2 | |
Allow pipe fd to be inherited under Ruby 2.0
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 23 |
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 |
