Skip to content

Commit

Permalink
One more try at deleting the tmp check file correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
melissalinkert committed Jul 18, 2024
1 parent 80f3ffb commit 44d031f
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/main/java/com/glencoesoftware/bioformats2raw/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1209,20 +1209,24 @@ public Integer call() throws Exception {
// a temp file is created and set as executable
// in the noexec case, setting as executable is expected to silently fail
File tmpdirCheck = File.createTempFile("noexec-test", ".txt");
// expect 'success' to be true in the noexec case, even though
// the file will not actually be executable
boolean success = tmpdirCheck.setExecutable(true);
if (!success || !tmpdirCheck.canExecute()) {
String msg = System.getProperty("java.io.tmpdir") +
" is noexec; fix it or specify a different java.io.tmpdir";
if (getWarnNoExec()) {
LOGGER.warn(msg);
}
else {
throw new RuntimeException(msg);
try {
// expect 'success' to be true in the noexec case, even though
// the file will not actually be executable
boolean success = tmpdirCheck.setExecutable(true);
if (!success || !tmpdirCheck.canExecute()) {
String msg = System.getProperty("java.io.tmpdir") +
" is noexec; fix it or specify a different java.io.tmpdir";
if (getWarnNoExec()) {
LOGGER.warn(msg);
}
else {
throw new RuntimeException(msg);
}
}
}
tmpdirCheck.delete();
finally {
tmpdirCheck.delete();
}

OpenCVTools.loadOpenCV();

Expand Down

0 comments on commit 44d031f

Please sign in to comment.