aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMartin Afanasjew2016-04-06 01:52:25 +0200
committerMartin Afanasjew2016-04-06 10:28:06 +0200
commit15b42301e55269d779a81e4a348ea92a3f16e4a0 (patch)
treec5ca2e6f2c54f00c995689dd169dc676be365ad6 /Library
parent37b817ed394986808d2fdb595c272ede7a67f20d (diff)
downloadbrew-15b42301e55269d779a81e4a348ea92a3f16e4a0.tar.bz2
brew.sh: make analytics 'curl' fully asynchronous
If analytics are enabled and `brew` is used in a command substitution context, e.g. `brew search` for tab completion, the result is that even though the Google Analytics `curl` process runs in the background it still is attached to the captured `stdout`, thus could theoretically contribute to the result of the command substitution and consequently makes the command substitution block on the completion of this process. Redirecting `stdout` (and `stderr` for good measure) to `/dev/null` makes this process truly asynchronous in these contexts. Furthermore, even if the process is in the background, it is still included in the shell's job list and thus shell internals like `wait` (used in `cmd/update.sh`) have to wait on this process, even if they never intended to do so. Removing the analytics process from the job list via `disown` avoids this unintended effect. Fixes #29. Closes #34. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
Diffstat (limited to 'Library')
-rw-r--r--Library/brew.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/Library/brew.sh b/Library/brew.sh
index cbde0e7c4..78f42ba3d 100644
--- a/Library/brew.sh
+++ b/Library/brew.sh
@@ -228,7 +228,8 @@ then
-d av="$HOMEBREW_VERSION" \
-d t=screenview \
-d cd="$HOMEBREW_COMMAND" \
- &
+ &> /dev/null \
+ & disown
fi
if [[ -n "$HOMEBREW_BASH_COMMAND" ]]