Skip to content

refactor: drop dead resolveGamescopePid, use helper MainPID directly (#37)#48

Open
hikaps wants to merge 1 commit into
developfrom
fix/gamescope-pid-cleanup
Open

refactor: drop dead resolveGamescopePid, use helper MainPID directly (#37)#48
hikaps wants to merge 1 commit into
developfrom
fix/gamescope-pid-cleanup

Conversation

@hikaps

@hikaps hikaps commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Removes a spurious, actively-misleading warning that surfaced in issue-28 logs (Instance 0 could not resolve gamescope PID from helper PID …) and looked like a culprit for a missing second Steam instance.

Root cause: dead logic, not a real failure

LaunchInstance returns the gamescope MainPID directly — the transient unit's ExecStart is gamescope (systemd-run … -- gamescope <args> -- /bin/bash -c <game>, Type=simple). But resolveGamescopePid() assumed the returned PID was a wrapper whose child is gamescope: it read /proc/<pid>/children and matched comm == gamescope. Gamescope's actual children are bash→the game, so it always returned 0 and logged the warning. The fallback on the next line already set m_gamescopePid = m_helperPid, i.e. the correct value.

So m_gamescopePid, WindowManager positioning, and SessionRunner::findSteamProcess() were all using the correct PID — the only effect was the false log line.

Change

Delete resolveGamescopePid (1 call site, 0 test refs) and assign directly:

// The helper's LaunchInstance returns the gamescope MainPID directly.
m_gamescopePid = m_helperPid;

Behavior unchanged (the fallback already produced this value); −37 lines.

Verified

test_gamescopeinstance: 21 passed, 0 failed.

Note: this does not fix the flatpak second-Steam-instance issue reported in #28 — that's flatpak-specific (host Steam coexisted fine in the native path), tracked separately.

…37)

LaunchInstance returns the gamescope MainPID (systemd-run ExecStart),
but resolveGamescopePid searched the returned PID's *children* for a
process named gamescope — so it always returned 0 and logged a spurious
'could not resolve gamescope PID' warning. The fallback already set
m_gamescopePid to the correct value, so this only removes the misleading
log line + ~32 lines of dead logic; behavior is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant