Skip to content

Commit 317b92c

Browse files
authored
简化 SystemUtils (#5315)
1 parent 35e6592 commit 317b92c

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/SystemUtils.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,9 @@ public static String run(String... command) throws Exception {
8181
}
8282

8383
public static <T> T run(List<String> command, ExceptionalFunction<InputStream, T, ?> convert) throws Exception {
84-
File nul = OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS
85-
? new File("NUL")
86-
: new File("/dev/null");
87-
8884
Process process = new ProcessBuilder(command)
89-
.redirectInput(nul)
90-
.redirectError(nul)
85+
.redirectInput(ProcessBuilder.Redirect.DISCARD)
86+
.redirectError(ProcessBuilder.Redirect.DISCARD)
9187
.start();
9288
try {
9389
InputStream inputStream = process.getInputStream();

0 commit comments

Comments
 (0)