Skip to content

Add timeout to WSL credential lookups#4

Merged
CodeZeno merged 1 commit intoCodeZeno:mainfrom
jacobdwyer16:fix/wsl-timeout
Mar 20, 2026
Merged

Add timeout to WSL credential lookups#4
CodeZeno merged 1 commit intoCodeZeno:mainfrom
jacobdwyer16:fix/wsl-timeout

Conversation

@jacobdwyer16
Copy link

On systems where WSL is installed but not fully working, wsl.exe -l -q can hang indefinitely. This blocks the poll thread during credential gathering so usage data never loads — the widget just shows -- forever.

The WSL token refresh paths already had a 30s timeout via wait_for_refresh, but list_wsl_distros and read_wsl_credentials were using .output() with no deadline.

This adds a small run_with_timeout helper that polls try_wait and kills the process after 5 seconds, then uses it for both WSL calls. The rest of the poll logic already handles the None/empty case gracefully.

Ran into this on a Windows 11 machine where wsl.exe -l -q hangs for 10+ minutes.

wsl.exe -l -q can hang indefinitely on some systems (e.g. WSL
installed but not fully configured), which blocks the poll thread
forever and prevents any usage data from loading.

Adds a run_with_timeout helper (5s deadline) and uses it for both
list_wsl_distros and read_wsl_credentials. The refresh paths
already had timeouts — these two were missed.
@CodeZeno CodeZeno merged commit 81a26ea into CodeZeno:main Mar 20, 2026
@CodeZeno
Copy link
Owner

Thank you @jacobdwyer16

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.

2 participants