Skip to content

Commit ae29780

Browse files
committed
fix(dream-cli): double-quote tmpdir in gpu_reassign RETURN trap
_gpu_reassign registered a cleanup trap with single-quoted outer syntax, so $tmpdir expansion was deferred until fire time. RETURN traps are process-level (not function-scoped), so when the function returns to cmd_gpu the trap fires again in cmd_gpu's scope where $tmpdir is unbound. Under set -u that triggers 'tmpdir: unbound variable' and exit 1 even on successful reassign. Switched to double-quoted outer to bake $tmpdir in at trap-set time (single-quoted inner keeps paths with spaces safe). Matches the already-landed pattern at dream-cli:542. macOS Apple Silicon and AMD paths are unaffected (the nvidia-smi early-return at line 2825 precedes the trap registration). Linux NVIDIA and Windows WSL2 + NVIDIA passthrough are the affected surface.
1 parent d5154c3 commit ae29780

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

dream-server/dream-cli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2866,7 +2866,7 @@ _gpu_reassign() {
28662866
# Write topology to tmpfile and run assignment
28672867
local tmpdir
28682868
tmpdir=$(mktemp -d)
2869-
trap 'rm -rf "$tmpdir"' RETURN
2869+
trap "rm -rf '$tmpdir'" RETURN
28702870
echo "$topo_json" > "$tmpdir/topo.json"
28712871

28722872
local enabled_services="${ENABLED_SERVICES:-llama_server,whisper,comfyui,embeddings}"

0 commit comments

Comments
 (0)