From 20c2100676cb6943f69d20fd0b38d95332ab2f03 Mon Sep 17 00:00:00 2001 From: Lucas Chollet Date: Sat, 28 Feb 2026 12:29:58 +0100 Subject: [PATCH] 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. --- Meta/shell_include.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Meta/shell_include.sh b/Meta/shell_include.sh index 9a8192f87ed..0c3bf77f465 100644 --- a/Meta/shell_include.sh +++ b/Meta/shell_include.sh @@ -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