Repository navigation
fix: retry admin privilege check on timeout instead of caching false - #2248
Merged
Memory2314 merged 1 commit intoOct 25, 2026
Merged
Conversation
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
Contributor
|
Thanks for this PR! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2247.
On slow machines
fltmcandnet sessioncan exceed the 1.5s timeout and get killed. The killed process hascodenull, which|| 0turned 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.