Skip to content

Commit

Permalink
replaced error-prone single-string exec(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed Oct 28, 2022
1 parent d4f2fd8 commit 1fceab4
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ static String getWinFspInstallDir() throws WinFspNotFoundException {

static String readWinFspInstallDirFromRegistry() {
try {
Process p = Runtime.getRuntime().exec("reg query " + REG_WINFSP_KEY + " /v " + REG_WINFSP_VALUE);
ProcessBuilder command = new ProcessBuilder("reg", "query", REG_WINFSP_KEY, "/v", REG_WINFSP_VALUE);
Process p = command.start();
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
p.waitFor(3000, TimeUnit.MILLISECONDS);
if (p.exitValue() != 0) {
Expand All @@ -52,13 +53,11 @@ static boolean isWinFspInstalled() {
}
}


static class WinFspNotFoundException extends RuntimeException {

public WinFspNotFoundException(Exception e) {
super(e);
}
}


}

0 comments on commit 1fceab4

Please sign in to comment.