run-eval.sh — 임시 폴더가 지워지지 않던 문제 수정

execute() 가 smoke 를 파이프로 돌리는데(smoke ... | tee) tmp_new 가 smoke() 안에 있어
TMP 가 서브셸에서만 설정됐다. 부모 셸의 tmp_rm 은 빈 TMP 를 보고 아무것도 지우지 않아,
실행할 때마다 /tmp/run-eval-<pid>-<rand> 가 실행 환경(컨테이너 또는 호스트)에 쌓였다.
Azure 컨테이너에 36개가 남아 있었다.

- tmp_new 를 execute() 의 파이프 밖으로 옮김
- 중단·오류로 빠져나가도 남지 않게 EXIT 훅(cleanup_exit)에서도 tmp_rm

검증: 로컬 연속 2회 실행 후 /tmp/run-eval-* 잔재 0개.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
민헌andClaude Opus 5 committed 2026-09-11 13:28:52 +09:00
1 parent f59ee53689
commit 56e44036d7
1 file changed
+3 -1
+3 -1
View File
@@ -95,6 +95,7 @@ stop_local_server() {
# 컨테이너(root)가 만든 캐시가 host 소유로 남게 정리한다
cleanup_exit() {
stop_local_server
tmp_rm
[ "$MODE" = docker ] && sudo -n chown -R "$(id -u):$(id -g)" "$REPO/eval" 2>/dev/null
return 0
}
@@ -216,7 +217,6 @@ run_one_smoke() { # ①을 3건 돌려 $TMP 에 원천을 만든다 (③⑩
# ---- 가볍게 ---------------------------------------------------------------
smoke() {
local n="$1"
tmp_new
case "$n" in
1) need_server || return 1
run_one_smoke ;;
@@ -268,6 +268,8 @@ execute() {
say "${C_Y} 아래 수치는 파이프라인이 도는지 보는 표본 결과이고, 성적서 수치가 아닙니다${C_0}"
say "${C_Y} (정본은 각 지표의 result.json — 실행 후 그대로 복원됩니다).${C_0}"
guard_start "$(dir_of "$n")" || return 1
# tmp_new 는 반드시 파이프 밖에서 — 안에서 만들면 TMP 가 서브셸에만 남아 tmp_rm 이 헛돈다
tmp_new
smoke "$n" 2>&1 | tee "$log"; rc=${PIPESTATUS[0]}
tmp_rm
guard_end