Fix issue #48093: set SystemTemp environment variable#52181
Open
chemodax wants to merge 1 commit intomoby:masterfrom
Open
Fix issue #48093: set SystemTemp environment variable#52181chemodax wants to merge 1 commit intomoby:masterfrom
chemodax wants to merge 1 commit intomoby:masterfrom
Conversation
vvoland
requested changes
Mar 16, 2026
Contributor
vvoland
left a comment
There was a problem hiding this comment.
Thanks! Change looks good to me, but:
- Please squash into one commit
- Please use your real name in a sign-off (currently is
Signed-off-by: chemodax)
e2c7ab4 to
da9e338
Compare
On Windows also set the SystemTemp environment variable, because for system processes GetTempPath2() uses it rather than TEMP/TMP: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2w Signed-off-by: Ivan Zhakov <ivan@chemodax.net>
Contributor
Author
It should be fixed now. Thanks! |
thaJeztah
approved these changes
Mar 17, 2026
Comment on lines
864
to
+869
| _ = os.Setenv("TEMP", realTmp) | ||
| _ = os.Setenv("TMP", realTmp) | ||
| // Set the SystemTemp environment variable, because for system processes | ||
| // GetTempPath2() uses it rather than TEMP/TMP: | ||
| // https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2w | ||
| _ = os.Setenv("SystemTemp", realTmp) |
Member
There was a problem hiding this comment.
Did a quick check if we had any code depending on the env-var specific, but only in a test-utility, and that one already had a comment to suggest using os.Tempdir() instead;
git grep -E 'os.Getenv\("(TMP|TEMP|TMPDIR)"\)'
integration-cli/utils_test.go: tmp = os.Getenv("TEMP")
git grep -E 'os.LookupEnv\("(TMP|TEMP|TMPDIR)"\)'
# no results
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.
On Windows also set the SystemTemp environment variable, because for system processes GetTempPath2() uses it rather than TEMP/TMP: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2w