DefangLabs / defang

Defang CLI and sample projects. Defang is a radically simpler way for developers to develop, deploy, and debug cloud applications.
https://defang.io
MIT License
37 stars 9 forks source link

Default install command fails on bash #631

Open lionello opened 2 months ago

lionello commented 2 months ago
$ which bash
/bin/bash

$ bash

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ echo $BASH_VERSION
3.2.57(1)-release
bash-3.2$ which curl
/usr/bin/curl
bash-3.2$ . <(curl -Ls s.defang.io/install)
bash-3.2$ echo $?
0
bash-3.2$ . <(curl -L s.defang.io/install)
bash-3.2$   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  9462  100  9462    0     0  22441      0 --:--:-- --:--:-- --:--:-- 22441
curl: Failed writing body

This still is the default "bash" on macOS Sonoma 14.6.1 (23G93)

https://stackoverflow.com/questions/32596123/why-source-command-doesnt-work-with-process-substitution-in-bash-3-2/32596626#32596626

Workarounds are to use eval or source /dev/stdin <<<"$(…)".

raphaeltm commented 2 months ago

Do I understand correctly that it's because it's an old bash, but that the old bash is still the default?

Would it fix anything to pipe the output into sh? I'm seeing that the GitHub and NATS CLIs both use that kind of install process:

curl -sS https://webi.sh/gh | sh
curl -sf https://binaries.nats.dev/nats-io/natscli/nats@latest | sh

If I remember correctly, there was a reason I didn't do that... but I can't remember what it was unfortunately.

raphaeltm commented 2 months ago

Interesting. Just realizing that the Github installer uses this: https://webinstall.dev/

lionello commented 1 month ago

So far I've only personally had two reports of this, so this does break bash users, but there aren't that many (and we have other installers)