mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-18 05:20:48 +00:00
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.
This commit is contained in:
committed by
Gustavo Madeira Santana
parent
3e8baf1e88
commit
1c18f08cc6
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user