Skip to content

Commit 4d86cee

Browse files
committed
Use system_profiler fallback if hostname address cannot be determined
Signed-off-by: Jan Dubois <[email protected]>
1 parent 66f66e1 commit 4d86cee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hack/test-port-forwarding.pl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222

2323
my $instance = shift;
2424

25-
my $ipv4 = inet_ntoa(scalar gethostbyname(hostname())) or die;
25+
my $addr = scalar gethostbyname(hostname());
26+
# If hostname address cannot be determines, use localhost to trigger fallback to system_profiler lookup
27+
my $ipv4 = length $addr ? inet_ntoa($addr) : "127.0.0.1";
2628
my $ipv6 = ""; # todo
2729

2830
# macOS Github runners seem to use "localhost" as the hostname

0 commit comments

Comments
 (0)