diff options
| author | Charlie Sharpsteen | 2012-07-06 12:56:18 -0800 | 
|---|---|---|
| committer | Charlie Sharpsteen | 2012-07-09 09:21:33 -0800 | 
| commit | a30f427ae291229cacb3a9f69447651b8a546e2e (patch) | |
| tree | deeed8225763d0f0ddae7b6d52cec8ba88d7ec73 /Library/Homebrew/utils.rb | |
| parent | e87492b2838493c6e4d0a2042a8208d3ce7be257 (diff) | |
| download | homebrew-a30f427ae291229cacb3a9f69447651b8a546e2e.tar.bz2 | |
quiet_system: Dump to /dev/null instead of closing
Some programs fail where they would otherwise succeed if stdout or stderr is
closed. For example, using mpicc from the mpich2 formula:
    quiet_system 'mpicc', '--version'
Fails with:
    LLVM ERROR: IO failure on output stream.
While
    system 'mpicc', '--version'
Succeeds.
Closes #13253.
Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 6 | 
1 files changed, 4 insertions, 2 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 2af1072c4..4099c4825 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -109,8 +109,10 @@ end  # prints no output  def quiet_system cmd, *args    Homebrew.system(cmd, *args) do -    $stdout.close -    $stderr.close +    # Redirect output streams to `/dev/null` instead of closing as some programs +    # will fail to execute if they can't write to an open stream. +    $stdout.reopen('/dev/null') +    $stderr.reopen('/dev/null')    end  end  | 
