Skip to content

Commit

Permalink
Ensure Files.createTempDirectory honors java.io.tmpdir system property
Browse files Browse the repository at this point in the history
Signed-off-by: Arun Gopalpuri <[email protected]>
  • Loading branch information
arun0009 committed Dec 11, 2024
1 parent 5aa6509 commit db80f53
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ static void exit(final int status) {
}

@SuppressForbidden(reason = "Files#createTempDirectory(String, FileAttribute...)")
static Path createTempDirectory(final String prefix, final FileAttribute<?>... attrs) throws IOException {
return Files.createTempDirectory(prefix, attrs);
static Path createTempDirectory(final Path rootDir, final String prefix, final FileAttribute<?>... attrs) throws IOException {
return Files.createTempDirectory(rootDir, prefix, attrs);

Check warning on line 79 in distribution/tools/launchers/src/main/java/org/opensearch/tools/launchers/Launchers.java

View check run for this annotation

Codecov / codecov/patch

distribution/tools/launchers/src/main/java/org/opensearch/tools/launchers/Launchers.java#L79

Added line #L79 was not covered by tests
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static void main(final String[] args) throws IOException {
path = Paths.get(System.getProperty("java.io.tmpdir"), "opensearch");
Files.createDirectories(path);
} else {
path = Launchers.createTempDirectory("opensearch-");
path = Launchers.createTempDirectory(Paths.get(System.getProperty("java.io.tmpdir")), "opensearch-");

Check warning on line 67 in distribution/tools/launchers/src/main/java/org/opensearch/tools/launchers/TempDirectory.java

View check run for this annotation

Codecov / codecov/patch

distribution/tools/launchers/src/main/java/org/opensearch/tools/launchers/TempDirectory.java#L67

Added line #L67 was not covered by tests
}
Launchers.outPrintln(path.toString());
}
Expand Down

0 comments on commit db80f53

Please sign in to comment.