Prefer platform_is_not :windows.

This commit is contained in:
Samuel Williams 2025-02-01 00:28:35 +13:00 committed by Benoit Daloze
parent f719b889a1
commit 0da2b12741
Notes: git 2025-01-31 12:00:44 +00:00

View File

@ -3,11 +3,13 @@ require_relative '../fixtures/classes'
describe "Socket.gethostname" do
def system_hostname
# Most platforms implement this POSIX standard:
`uname -n`.strip
rescue
# Only really required for Windows without MSYS/MinGW/Cygwin etc:
`hostname`.strip
if platform_is_not :windows
# `uname -n` is the most portable way to get the hostname, as it is a POSIX standard:
`uname -n`.strip
else
# Windows does not have uname, so we use hostname instead:
`hostname`.strip
end
end
it "returns the host name" do