Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2022 Red Hat Inc. and others.
* Copyright (c) 2019, 2024 Red Hat Inc. and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand All @@ -20,7 +20,6 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -206,8 +205,7 @@ public static File which(String program) {
} else if (Platform.getOS().equals(Platform.OS_MACOSX)) {
command = new String[] { getDefaultShellMacOS(), "-c", "-li", "which " + program };
}
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(Runtime.getRuntime().exec(command).getInputStream()));) {
try (BufferedReader reader = Runtime.getRuntime().exec(command).inputReader()) {
res = reader.readLine();
} catch (IOException e) {
ILog.get().error(e.getMessage(), e);
Expand Down Expand Up @@ -297,8 +295,7 @@ private static final File getNodeJsExecutablen(File installationLocation, Proper
private static String getDefaultShellMacOS() {
String res = null;
String[] command = { "/bin/bash", "-c", "-l", "dscl . -read ~/ UserShell" };
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(Runtime.getRuntime().exec(command).getInputStream()));) {
try (BufferedReader reader = Runtime.getRuntime().exec(command).inputReader()) {
res = reader.readLine();
if (!res.startsWith(MACOS_DSCL_SHELL_PREFIX)) {
ILog.get().error("Cannot find default shell. Use '/bin/zsh' instead.");
Expand All @@ -323,8 +320,7 @@ private static void validateNodeVersion(File nodeJsLocation) {
String nodeVersion = null;
String[] nodeVersionCommand = { nodeJsLocation.getAbsolutePath(), "-v" };

try (BufferedReader reader = new BufferedReader(
new InputStreamReader(Runtime.getRuntime().exec(nodeVersionCommand).getInputStream()));) {
try (BufferedReader reader = Runtime.getRuntime().exec(nodeVersionCommand).inputReader()) {
nodeVersion = reader.readLine();
} catch (IOException e) {
ILog.get().error(e.getMessage(), e);
Expand Down
Loading