Fix race condition: wait for container ready before launching CS Core
podman run -d returns before the container process is running. CS Core's claude-code check immediately calls our wrapper, which found the container not yet running and exited 1 — causing the "claude-code not found" error. Add a poll loop (10 x 0.5s) that waits for State.Running=true before setting PATH and launching CS Core. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
120fc913f4
commit
6aa4c22d9e
1 changed files with 14 additions and 1 deletions
|
|
@ -82,7 +82,20 @@ echo "→ Starting agents container '\$CONTAINER_NAME'..."
|
|||
"\$IMAGE_NAME" \\
|
||||
sleep infinity
|
||||
|
||||
echo "→ Container ready."
|
||||
# ── Wait for container to be running ────────────────────────────────────
|
||||
echo -n "→ Waiting for container..."
|
||||
for _i in 1 2 3 4 5 6 7 8 9 10; do
|
||||
if "\$RUNTIME" container inspect "\$CONTAINER_NAME" --format '{{.State.Running}}' 2>/dev/null | grep -q true; then
|
||||
echo " ready."
|
||||
break
|
||||
fi
|
||||
echo -n "."
|
||||
sleep 0.5
|
||||
done
|
||||
if ! "\$RUNTIME" container inspect "\$CONTAINER_NAME" --format '{{.State.Running}}' 2>/dev/null | grep -q true; then
|
||||
echo ""
|
||||
echo "Error: container failed to start." >&2; exit 1
|
||||
fi
|
||||
|
||||
# ── Put claude wrapper first on PATH ────────────────────────────────────
|
||||
export PATH="\$PROJECT_DIR/bin:\$PATH"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue