Fix graphical brew edit behaviour

- Without `DISPLAY` as an envvar in `bin/brew`, running `brew edit`
  with $EDITOR set to a graphical editor (eg `gedit`), it errored on
  Linux:

```
$ EDITOR=gedit brew edit vim

Editing
/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/vim.rb
Unable to init server: Could not connect: Connection refused

(org.gnome.gedit:15470): Gtk-WARNING **: 18:17:07.537: cannot open display:
Error: Failure while executing; `gedit
/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/vim.rb`
exited with 1.
```

Fixes #6958.
This commit is contained in:
Issy Long 2020-01-26 18:18:11 +00:00
parent 4f10b38328
commit e6ff4dda50
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4

View File

@ -88,7 +88,7 @@ then
FILTERED_ENV=()
# Filter all but the specific variables.
for VAR in HOME SHELL PATH TERM TERMINFO COLUMNS LOGNAME USER CI SSH_AUTH_SOCK SUDO_ASKPASS \
for VAR in HOME SHELL PATH TERM TERMINFO COLUMNS DISPLAY LOGNAME USER CI SSH_AUTH_SOCK SUDO_ASKPASS \
http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY \
"${!HOMEBREW_@}" "${!TRAVIS_@}"
do