-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a tmp directory when such doesn't exist. In some cases the tmp… #10002
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -436,6 +436,14 @@ | |
// https://github.com/jenkinsci/jenkins/pull/3161 ) | ||
final Path tempPath; | ||
final String tempDirNamePrefix = "jenkins"; | ||
|
||
final Path systemTmpDirectoryPath = Path.of(System.getProperty("java.io.tmpdir")); | ||
if (!systemTmpDirectoryPath.toFile().exists()){ | ||
// In some cases the tmp directory set in the java.io.tmpdir property will not exist and hence will have to | ||
// be created here. | ||
systemTmpDirectoryPath.toFile().mkdirs(); | ||
Check warning on line 444 in core/src/main/java/hudson/Util.java ci.jenkins.io / Code CoverageNot covered line
Check warning on line 444 in core/src/main/java/hudson/Util.java ci.jenkins.io / SpotBugsRV_RETURN_VALUE_IGNORED_BAD_PRACTICE
Raw output
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using Files.createDirectory instead should avoid the SpotBugs warning. |
||
} | ||
|
||
if (FileSystems.getDefault().supportedFileAttributeViews().contains("posix")) { | ||
tempPath = Files.createTempDirectory(tempDirNamePrefix, | ||
PosixFilePermissions.asFileAttribute(EnumSet.allOf(PosixFilePermission.class))); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.