diff options
| author | Max Howell | 2009-10-24 15:57:23 +0100 |
|---|---|---|
| committer | Max Howell | 2009-10-24 16:20:58 +0100 |
| commit | ffe4f25d87741199cfba2052ff810712ef94854b (patch) | |
| tree | fa5613e285c93d325c105286bf8c839f0d1cc7e3 /bin | |
| parent | fc9ea77bb3c5e7c3ce2852be181fadf1b49cd304 (diff) | |
| download | brew-ffe4f25d87741199cfba2052ff810712ef94854b.tar.bz2 | |
Marshal install.rb exceptions back to the parent process
Using an error pipe.
The use of ENV[HOMEBREW_ERROR_PIPE] feels wrong, but I wasn't sure how else to
proxy the file descriptor to the child process since the fork immediately
calls exec.
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/brew | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -163,17 +163,21 @@ begin # the easiest way to do this # 2. formulae have access to __END__ the only way to allow this is # to make the formula script the executed script - pid=fork - if pid.nil? - exec '/usr/bin/ruby', '-I', homebrew_rubylib_path, '-rinstall', f.path, '--', *ARGV.options - else - Process.wait pid - end - #FIXME I don't think $? represents the exit code from the child fork… - exit! $? if $? != 0 # exception in other brew will be visible on screen + read, write = IO.pipe + # 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 + + if not fork + read.close + exec '/usr/bin/ruby', '-I', homebrew_rubylib_path, '-rinstall', f.path, '--', *ARGV.options + else + write.close + data = read.read + raise Marshal.load(data) unless data.nil? or data.empty? + Process.wait end end - + end when 'up', 'update' require 'update' |
