Skip to content

Commit

Permalink
Merge pull request #16516 from geoand/remove-null-file
Browse files Browse the repository at this point in the history
Remove NULL_FILE usage now that we moved to Java 11
  • Loading branch information
geoand authored Apr 14, 2021
2 parents d702b24 + 9a4bf00 commit 3d6d3e9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ private String doGetEffectiveCommand() {
List<String> command = new ArrayList<>(1 + markerArgs.size());
command.add(defaultCommand);
command.addAll(markerArgs);
new ProcessBuilder(command).redirectError(IdeUtil.NULL_FILE).redirectOutput(IdeUtil.NULL_FILE).start()
new ProcessBuilder(command).redirectError(ProcessBuilder.Redirect.DISCARD.file())
.redirectOutput(ProcessBuilder.Redirect.DISCARD.file()).start()
.waitFor(10,
TimeUnit.SECONDS);
return defaultCommand;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package io.quarkus.deployment.ide;

import java.io.File;
import java.util.Locale;

final class IdeUtil {

// copied from Java 9
// TODO remove when we move to Java 11
static final File NULL_FILE = new File(isWindows() ? "NUL" : "/dev/null");

private IdeUtil() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import java.io.BufferedInputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -728,8 +727,8 @@ private boolean decompile(Path fernflowerJar, Path decompiledOutputDir, Path jar
if (log.isDebugEnabled()) {
processBuilder.inheritIO();
} else {
processBuilder.redirectError(NULL_FILE);
processBuilder.redirectOutput(NULL_FILE);
processBuilder.redirectError(ProcessBuilder.Redirect.DISCARD.file())
.redirectOutput(ProcessBuilder.Redirect.DISCARD.file());
}
exitCode = processBuilder.start().waitFor();
} catch (Exception e) {
Expand Down Expand Up @@ -1313,9 +1312,4 @@ public boolean test(Path path, BasicFileAttributes basicFileAttributes) {
return basicFileAttributes.isRegularFile() && path.toString().endsWith(".json");
}
}

// copied from Java 9
// TODO remove when we move to Java 11

private static final File NULL_FILE = new File(SystemUtils.IS_OS_WINDOWS ? "NUL" : "/dev/null");
}

0 comments on commit 3d6d3e9

Please sign in to comment.