Use echo "y" instead of yes to avoid SIGPIPE

When using the `yes` command and piping it's output to pacman, it will
confirm the y/n question, however it will then keep running after pacman
ends, as it didn't sent an EOF back. Once that happens, as yes will try
to write more output after pacman process ended, the pipeline breaks,
making the process receive a `SIGPIPE` signal, which causes `yes` to
end.

This would normally be fine, however since we're using `set -euo
pipefail`, this signal causes the whole script to end with code 141. To
avoid this, as we know only a single confirmation will be needed here,
we use echo instead of yes, only supplying one "y" to pacman.
This commit is contained in:
ItsDrike 2023-08-01 14:03:13 +02:00
parent 6d327a133b
commit 35dcf5ffa0

View file

@ -84,7 +84,7 @@ yay -S --noconfirm --needed \
yay -S --noconfirm --needed \ yay -S --noconfirm --needed \
discord firefox chromium kitty mpv pcmanfm-qt file-roller obs-studio qbittorrent \ discord firefox chromium kitty mpv pcmanfm-qt file-roller obs-studio qbittorrent \
qalculate-gtk-nognome spotify nomacs qalculate-gtk-nognome spotify nomacs
yes | sudo pacman -S --ask 4 --noconfirm --needed nodejs-lts-gallium # ask for package overwrite (potentially conflicting with base 'nodejs' dep) and overwrite it (for stremio) echo "y" | sudo pacman -S --ask 4 --noconfirm --needed nodejs-lts-gallium # ask for package overwrite (potentially conflicting with base 'nodejs' dep) and overwrite it (for stremio)
yay -S --noconfirm --needed stremio yay -S --noconfirm --needed stremio
# Bluetooth # Bluetooth