Skip to content

fix: retry admin privilege check on timeout instead of caching false - #2248

Merged
Memory2314 merged 1 commit into
mihomo-party-org:smart_corefrom
drakeo338:claude/2247-fix
Oct 25, 2026
Merged

Memory2314 merged 1 commit into
mihomo-party-org:smart_corefrom
drakeo338:claude/2247-fix

Conversation

@drakeo338

Copy link
Copy Markdown
Contributor

Fixes #2247.

On slow machines fltmc and net session can exceed the 1.5s timeout and get killed. The killed process has code null, which || 0 turned into exit code 0, and the resulting "not admin" answer was cached for the whole session, so TUN stayed unavailable even when running elevated.

Now a timed-out probe is retried once with a 10s timeout, the real code or signal is logged, and the result is not cached when an attempt timed out and no command succeeded. Real non-zero exits are still cached as before.

Added unit tests in src/main/core/admin.test.ts (they fail on the old code and pass now). I did not run lint or typecheck on a Windows machine.

fltmc and net session ran with a 1.5s timeout, and a killed process
(code null, killed true) was turned into exit code 0 and then cached as
"not admin" for the rest of the session. Retry a timed-out command with
a 10s timeout, log the real code or signal, and do not cache the result
when an attempt timed out and no command succeeded. Real non-zero exits
are still cached as before.

Closes mihomo-party-org#2247
@Memory2314

Copy link
Copy Markdown
Contributor

Thanks for this PR!

@Memory2314
Memory2314 merged commit 500e54e into mihomo-party-org:smart_core Oct 25, 2026
3 checks passed
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.

[Bug] TUN Mode Admin Privilege Misjudgment on Slow Machines (2.0.4)

2 participants