Spaces:
Paused
Paused
fix: output logs to stderr (HF captures stderr for Docker SDK spaces)
Browse filesResearch shows HF Spaces may only capture stderr, not stdout, for
Docker SDK spaces. Route entrypoint.sh log() to stderr directly.
Route start-server.sh through tee to both logfile and stderr.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- scripts/entrypoint.sh +3 -4
- ubuntu-server/start-server.sh +3 -2
scripts/entrypoint.sh
CHANGED
|
@@ -10,11 +10,10 @@ set -e
|
|
| 10 |
LOGFILE="/var/log/huggingrun.log"
|
| 11 |
touch "$LOGFILE"
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
exec > >(tee -a "$LOGFILE") 2>&1
|
| 15 |
-
|
| 16 |
log() {
|
| 17 |
-
echo "$@"
|
|
|
|
| 18 |
}
|
| 19 |
|
| 20 |
log "========================================"
|
|
|
|
| 10 |
LOGFILE="/var/log/huggingrun.log"
|
| 11 |
touch "$LOGFILE"
|
| 12 |
|
| 13 |
+
# Log to stderr (HF captures stderr for Docker SDK spaces) + logfile
|
|
|
|
|
|
|
| 14 |
log() {
|
| 15 |
+
echo "$@" >&2
|
| 16 |
+
echo "$@" >> "$LOGFILE"
|
| 17 |
}
|
| 18 |
|
| 19 |
log "========================================"
|
ubuntu-server/start-server.sh
CHANGED
|
@@ -13,8 +13,9 @@ LOGFILE="/var/log/huggingrun.log"
|
|
| 13 |
export SSH_PORT="${SSH_PORT:-2222}"
|
| 14 |
export TTYD_PORT="${TTYD_PORT:-7681}"
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
log() {
|
| 20 |
echo "$*"
|
|
|
|
| 13 |
export SSH_PORT="${SSH_PORT:-2222}"
|
| 14 |
export TTYD_PORT="${TTYD_PORT:-7681}"
|
| 15 |
|
| 16 |
+
# Redirect ALL stdout to stderr (HF captures stderr for Docker SDK spaces)
|
| 17 |
+
# Also tee to logfile for /runlog endpoint
|
| 18 |
+
exec > >(tee -a "$LOGFILE" >&2) 2>&1
|
| 19 |
|
| 20 |
log() {
|
| 21 |
echo "$*"
|