Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions core/src/main/java/hudson/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {

Check warning on line 441 in core/src/main/java/hudson/Util.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 441 is only partially covered, one branch is missing
// In some cases the tmp directory set in the java.io.tmpdir property will not exist and hence will have to
// be created here.
Files.createDirectory(systemTmpDirectoryPath);

Check warning on line 444 in core/src/main/java/hudson/Util.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 444 is not covered by tests
}

if (FileSystems.getDefault().supportedFileAttributeViews().contains("posix")) {
tempPath = Files.createTempDirectory(tempDirNamePrefix,
PosixFilePermissions.asFileAttribute(EnumSet.allOf(PosixFilePermission.class)));
Expand Down
Loading