tao-shen Claude Opus 4.6 commited on
Commit
ebd3783
·
1 Parent(s): 22382b6

fix: stop redirecting stderr to logfile — HF captures stderr for logs

Browse files

The 2>&1 redirect in background subshell was silencing stderr,
preventing HF from capturing sync daemon output. Use tee to split
output to both logfile AND stderr (for HF runtime log API).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. scripts/entrypoint.sh +4 -3
scripts/entrypoint.sh CHANGED
@@ -59,7 +59,7 @@ try:
59
  except:
60
  api.create_repo(repo_id=repo, repo_type='dataset', private=True)
61
  print(f'[entrypoint] Created dataset: {repo}', flush=True)
62
- " >> "$LOGFILE" 2>&1 || log "[entrypoint] WARNING: Could not verify dataset"
63
  else
64
  log "[entrypoint] WARNING: persistence disabled (no token/repo)"
65
  fi
@@ -74,11 +74,12 @@ log "[entrypoint] Wrote /etc/huggingrun.env"
74
 
75
  # Background: init (download + restore) then start sync-loop
76
  # This runs AFTER services start so HF doesn't timeout
 
77
  (
78
  log "[entrypoint:bg] Starting init in background ..."
79
- python3 -u /opt/git_sync_daemon.py init >> "$LOGFILE" 2>&1
80
  log "[entrypoint:bg] Init done, starting sync-loop ..."
81
- exec python3 -u /opt/git_sync_daemon.py sync-loop >> "$LOGFILE" 2>&1
82
  ) &
83
  BG_PID=$!
84
  log "[entrypoint] Background init+sync PID=${BG_PID}"
 
59
  except:
60
  api.create_repo(repo_id=repo, repo_type='dataset', private=True)
61
  print(f'[entrypoint] Created dataset: {repo}', flush=True)
62
+ " 2>&1 | tee -a "$LOGFILE" >&2 || log "[entrypoint] WARNING: Could not verify dataset"
63
  else
64
  log "[entrypoint] WARNING: persistence disabled (no token/repo)"
65
  fi
 
74
 
75
  # Background: init (download + restore) then start sync-loop
76
  # This runs AFTER services start so HF doesn't timeout
77
+ # IMPORTANT: do NOT redirect stderr (2>&1) — HF captures stderr for runtime logs
78
  (
79
  log "[entrypoint:bg] Starting init in background ..."
80
+ python3 -u /opt/git_sync_daemon.py init 2>&1 | tee -a "$LOGFILE" >&2
81
  log "[entrypoint:bg] Init done, starting sync-loop ..."
82
+ python3 -u /opt/git_sync_daemon.py sync-loop 2>&1 | tee -a "$LOGFILE" >&2
83
  ) &
84
  BG_PID=$!
85
  log "[entrypoint] Background init+sync PID=${BG_PID}"