Skip to content

fix(windows/uninstall-gc): cleanup gc program even if uninstall failed - #5089

Closed
Cloud0310 wants to merge 3 commits into
rust-lang:mainfrom
Cloud0310:windows-gc-error-cleanup
Closed

Cloud0310 wants to merge 3 commits into
rust-lang:mainfrom
Cloud0310:windows-gc-error-cleanup

Conversation

@Cloud0310

@Cloud0310 Cloud0310 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Proceeding of #5088.
This fixed cleanup rustup-gc.exe even if uninstallation fails, also keeping the error information for better tracing.

Use OpenOptions for the existing read, sharing and delete-on-close flags.
Pass the file as GC stdin, then inherit stdin in the cleanup child so the
standard library manages handle inheritance without raw handle APIs.
Keep Command alive through the existing sleep to retain the parent handle.

Keep the GC path, copy helper and process lifetime unchanged.
Inline the single-use ensure_empty helper and replace GcErr with an inline error. Preserve the existing directory and GC filename filter.
Attempt the existing GC self-cleanup even if waiting for the parent or removing cargo-home state fails. Preserve the original uninstall error when starting cleanup also fails; report the cleanup error when uninstalling succeeded.
@Cloud0310 Cloud0310 changed the title fix(windows gc): cleanup gc program even if uninstall failed fix(windows/uninstall-gc): cleanup gc program even if uninstall failed Sep 16, 2026
@rami3l

rami3l commented Sep 16, 2026

Copy link
Copy Markdown
Member

@Cloud0310 I think you can close this and drop the last commit over to #5088. Just deleting/pushing your branches on your fork should do the job.

@Cloud0310
Cloud0310 marked this pull request as draft September 16, 2026 18:30
@Cloud0310 Cloud0310 closed this Sep 16, 2026
@Cloud0310
Cloud0310 deleted the windows-gc-error-cleanup branch September 16, 2026 19:36
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