mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
Meta: Avoid grep failures in scripts that include shell_include.sh
In environments without any `SERENITY*` variables, grep returns an exit status of 1. This patch ensures that the subcommand exits with status 0 regardless of whether grep finds a match. This prevents the script from bailing out when `set -eo pipefail` is enabled.
This commit is contained in:
1 parent
5d7141dc6a
commit
20c2100676
1 file changed
+2
-2
@@ -14,8 +14,8 @@ die() {
|
||||
if [ "$(uname -s)" = "SerenityOS" ]; then
|
||||
SUDO="pls -E"
|
||||
elif command -v sudo >/dev/null; then
|
||||
# Preserve all environment variables starting with SERENITY_.
|
||||
SERENITY_VARS=$(env | cut -d= -f1 | grep '^SERENITY' | tr '\n' ',' | sed 's/,$//')
|
||||
# Preserve all environment variables starting with SERENITY.
|
||||
SERENITY_VARS=$(env | cut -d= -f1 | (grep '^SERENITY' || [[ $? -eq 1 ]]) | tr '\n' ',' | sed 's/,$//')
|
||||
SUDO="sudo --preserve-env=$SERENITY_VARS"
|
||||
elif command -v doas >/dev/null; then
|
||||
if [ "$SUDO_UID" = '' ]; then
|
||||
|
||||
Reference in new issue
Block a user