Skip to content

Commit 1d848a7

Browse files
committed
bug: fix steam multi launch
1 parent 95c0585 commit 1d848a7

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

src/lib/steam.sh

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,7 @@ cloud_conflict_active() {
15001500
# scope; we invoke it as `"$1"`.
15011501
wait_for_cs2_process() {
15021502
local applaunch_fn="${1:?applaunch function name required}"
1503-
local pid="" i=0 cloud_pokes=0 cloud_detected=0
1503+
local pid="" i=0 cloud_pokes=0 cloud_detected=0 steam_gone=0
15041504
# Re-applaunch recovery state (see header): count + last loop we re-launched.
15051505
local relaunches=0 last_relaunch_i=0
15061506

@@ -1551,6 +1551,27 @@ wait_for_cs2_process() {
15511551

15521552
[ $(( i % 15 )) -eq 0 ] && log " ${i}s elapsed waiting on cs2..."
15531553

1554+
# Steam client watchdog: the client can segfault after boot (breakpad dump
1555+
# fires, the steam.sh wrapper survives holding the IPC pipe) — every
1556+
# applaunch then "forwards" into the corpse and cs2 never spawns. Three
1557+
# consecutive 5s checks with no client process = dead → full restart.
1558+
if [ $(( i % 5 )) -eq 0 ]; then
1559+
if pgrep -f 'ubuntu12_32/steam' >/dev/null 2>&1; then
1560+
steam_gone=0
1561+
else
1562+
steam_gone=$(( steam_gone + 1 ))
1563+
if [ "$steam_gone" -ge 3 ]; then
1564+
log " Steam client process gone ~15s (segfault?) — restarting Steam"
1565+
kill_steam
1566+
start_steam
1567+
wait_for_steam_pipe "${STEAM_PIPE_TIMEOUT:-300}"
1568+
wait_for_main_steam_window "${STEAM_WINDOW_TIMEOUT:-300}" || true
1569+
steam_gone=0; cloud_pokes=0; relaunches=0; last_relaunch_i=$i
1570+
"$applaunch_fn"
1571+
fi
1572+
fi
1573+
fi
1574+
15541575
# Surface a Steam game-file validation pass (corrupt-files repair / partial
15551576
# update) as status=validating. Self-throttles; no-op when not validating.
15561577
# Capture whether it's actively validating so re-applaunch holds off.

0 commit comments

Comments
 (0)