Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue 21059: installer fails when piped on Posix. #463

Merged
merged 2 commits into from Jul 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions script/install.sh
Expand Up @@ -9,9 +9,11 @@ _() {

# Returns false if the script is invoked from a Windows command prompt.
posix_terminal() {
# If this script is run on Windows cmd by passing it as argument to bash.exe,
# the shell level will be 1. If it is run from a POSIX terminal, it will be > 1.
if [ "$SHLVL" = 1 ]; then
# If run from a POSIX terminal (including under MSYS2 or Cygwin) the TERM
# variable is defined to something like "xterm". If run from a Windows
# command prompt through bash.exe from an MSYS installation, TERM keeps
# its default value, which is "cygwin".
if [[ "${TERM:-noterm}" == "cygwin" ]]; then
false
Copy link
Member

@wilzbach wilzbach Jul 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are no booleans in bash!

Suggested change
false
return 0

(I'm aware that it works, but it's still a bad style)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you got it backwards. return 0 == true in bash, unlike D. https://stackoverflow.com/questions/23320150/bash-boolean-testing/23324368#23324368. I believe I had it this way in my first iteration and you commented rightfully that it was confusing. Good or bad style, at least this cannot be misunderstood.

else
true
Expand Down