From cb5848c7b7b03680df1943c7b612e15af23023bb Mon Sep 17 00:00:00 2001 From: Khang Nguyen Duy Date: Wed, 11 Dec 2024 16:47:20 +0700 Subject: [PATCH] command: fix hostname test compatibility hostname is not guaranteed on *nix as in the comment. For example, Arch does not have hostname by default. --- src/Command.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Command.zig b/src/Command.zig index daca54f94..2b600979f 100644 --- a/src/Command.zig +++ b/src/Command.zig @@ -440,9 +440,9 @@ fn isExecutable(mode: std.fs.File.Mode) bool { return mode & 0o0111 != 0; } -// `hostname` is present on both *nix and windows +// `uname -n` is the *nix equivalent of `hostname.exe` on Windows test "expandPath: hostname" { - const executable = if (builtin.os.tag == .windows) "hostname.exe" else "hostname"; + const executable = if (builtin.os.tag == .windows) "hostname.exe" else "uname"; const path = (try expandPath(testing.allocator, executable)).?; defer testing.allocator.free(path); try testing.expect(path.len > executable.len);