Repository navigation
Conversation
ArgsResolver created its default temporary directory on initialization, whether or not any job used it. When the driver execs a job in place, the process is replaced and the cleanup in `Driver.run` never runs, so every `swiftc -print-target-info`, `-version`, or single-job invocation left an empty temporary directory behind. Create the directory on first use instead: when a temporary path is resolved or a response file is written. A caller-supplied directory is still created eagerly. Fixes swiftlang#2049
When the driver has a single job, it execs that job in place of itself and its temporary-directory cleanup never runs. A job that writes a file list or a response file therefore leaked its temporary directory. Port the legacy driver's check: exec only if the temporary directory doesn't exist yet and resolving the job won't create it, or if `-save-temps` keeps the files anyway. Otherwise run the job as a child process. Likewise don't exec when `-driver-warn-unused-options` is passed, since its warnings are printed after the job finishes. Fixes swiftlang#2049
Contributor
Author
|
@swift-ci test |
owenv
approved these changes
Oct 20, 2026
Contributor
Author
|
@swift-ci test Windows |
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.
Create ArgsResolver's temporary directory lazily
ArgsResolvercreated its default temporary directory on initialization, whether or not any job used it. When the driver execs a job in place, the process is replaced and the cleanup inDriver.runnever runs, so everyswiftc -print-target-info,-version, or single-job invocation left an empty temporary directory behind.Create the directory on first use instead: when a temporary path is resolved or a response file is written. A caller-supplied directory is still created eagerly.
Don't
execa single job that leaves temporaries behindWhen the driver has a single job, it
execs that job in place of itself and its temporary-directory cleanup never runs. A job that writes a file list or a response file therefore leaked its temporary directory.Port the legacy driver's check:
execonly if the temporary directory doesn't exist yet and resolving the job won't create it, or if-save-tempskeeps the files anyway. Otherwise run the job as a child process. Likewise don't exec when-driver-warn-unused-optionsis passed, since its warnings are printed after the job finishes.Resolves #2049