diff options
Diffstat (limited to 'Library/Homebrew/extend/ENV/super.rb')
| -rw-r--r-- | Library/Homebrew/extend/ENV/super.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index d03f10981..603e4c052 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -241,8 +241,21 @@ module Superenv public + # Removes the MAKEFLAGS environment variable, causing make to use a single job. + # This is useful for makefiles with race conditions. + # When passed a block, MAKEFLAGS is removed only for the duration of the block and is restored after its completion. + # Returns the value of MAKEFLAGS. def deparallelize - delete('MAKEFLAGS') + old = delete('MAKEFLAGS') + if block_given? + begin + yield + ensure + self['MAKEFLAGS'] = old + end + end + + old end alias_method :j1, :deparallelize |
