Skip to content

Commit

Permalink
powershell no-logo (#3556)
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainJuge authored Mar 11, 2024
1 parent 6d4b20e commit c5ed2e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes:
[float]
===== Bug fixes
* Avoid another case where we might touch application exceptions for `safe_exceptions` - {pull}3553[#3553]
* More robust hostname detection on Windows - {pull}3556[#3556]
[[release-notes-1.48.0]]
==== 1.48.0 - 2024/03/05
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ static String fallbackHostnameDiscovery(boolean isWindows) {
static String discoverHostnameThroughCommand(boolean isWindows, long timeoutMillis) {
String hostname;
if (isWindows) {
hostname = executeHostnameDiscoveryCommand(Arrays.asList("powershell.exe", "[System.Net.Dns]::GetHostEntry($env:computerName).HostName"), timeoutMillis);
List<String> powershellCmd = Arrays.asList("powershell.exe",
"-NoLogo", "-NonInteractive", "-NoProfile", "-ExecutionPolicy", "Bypass",
"-Command", "[System.Net.Dns]::GetHostEntry($env:computerName).HostName");
hostname = executeHostnameDiscoveryCommand(powershellCmd, timeoutMillis);
if (hostname == null || hostname.isEmpty()) {
hostname = executeHostnameDiscoveryCommand(Arrays.asList("cmd.exe", "/c", "hostname"), timeoutMillis);
}
Expand Down

0 comments on commit c5ed2e1

Please sign in to comment.