test: fix portable stderr capture and env leakage (#55184)

This commit is contained in:
Tak Hoffman
2026-03-26 09:31:08 -05:00
committed by GitHub
parent dd46c3d75b
commit e403899cc1
2 changed files with 11 additions and 1 deletions

View File

@@ -104,12 +104,18 @@ last_commit_error=''
run_git_command() {
local stderr_log
stderr_log=$(mktemp)
if "$@" 2> >(tee "$stderr_log" >&2); then
if "$@" 2>"$stderr_log"; then
if [ -s "$stderr_log" ]; then
cat "$stderr_log" >&2
fi
rm -f "$stderr_log"
last_commit_error=''
return 0
fi
if [ -s "$stderr_log" ]; then
cat "$stderr_log" >&2
fi
last_commit_error=$(cat "$stderr_log")
rm -f "$stderr_log"
return 1

View File

@@ -18,6 +18,10 @@ const clearPlannerShardEnv = (env) => {
const nextEnv = { ...env };
delete nextEnv.OPENCLAW_TEST_SHARDS;
delete nextEnv.OPENCLAW_TEST_SHARD_INDEX;
delete nextEnv.OPENCLAW_TEST_FORCE_THREADS;
delete nextEnv.OPENCLAW_TEST_FORCE_FORKS;
delete nextEnv.OPENCLAW_TEST_DISABLE_THREAD_EXPANSION;
delete nextEnv.OPENCLAW_TEST_SHOW_POOL_DECISION;
return nextEnv;
};