From 1c18f08cc686d8460bf9c152a82939cc27ff64c8 Mon Sep 17 00:00:00 2001 From: Joey Krug Date: Fri, 13 Feb 2026 06:15:40 +0000 Subject: [PATCH] fix: handle missing date in no-node fallback path Use command -v guard and fallback to "unknown" timestamp when neither node nor date is available. Suppresses stderr and ensures valid JSON output in all minimal environments. --- scripts/recover-orphaned-processes.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/recover-orphaned-processes.sh b/scripts/recover-orphaned-processes.sh index 65bf55ef5fb..a6b26e8640f 100755 --- a/scripts/recover-orphaned-processes.sh +++ b/scripts/recover-orphaned-processes.sh @@ -30,7 +30,10 @@ if [ "$#" -gt 0 ]; then fi if ! command -v node &>/dev/null; then - echo '{"error":"node not found on PATH","orphaned":[],"ts":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'"}' + _ts="unknown" + command -v date &>/dev/null && _ts="$(date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null)" || true + [ -z "$_ts" ] && _ts="unknown" + printf '{"error":"node not found on PATH","orphaned":[],"ts":"%s"}\n' "$_ts" exit 0 fi