From 69d1453741701549ebb71acd319c49eafd674c20 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Tue, 2 Nov 2021 23:54:44 +0100 Subject: [PATCH] build: fix trailing newline in version string --- build.zig | 5 ++++- river/main.zig | 2 +- riverctl/main.zig | 2 +- rivertile/main.zig | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index fedb940..b0c951b 100644 --- a/build.zig +++ b/build.zig @@ -61,7 +61,10 @@ pub fn build(b: *zbs.Builder) !void { &ret, .Inherit, ) catch break :blk version; - break :blk try std.fmt.allocPrintZ(b.allocator, "{s}-{s}", .{ version, git_commit_hash }); + break :blk try std.fmt.allocPrintZ(b.allocator, "{s}-{s}", .{ + version, + mem.trim(u8, git_commit_hash, &std.ascii.spaces), + }); } else { break :blk version; } diff --git a/river/main.zig b/river/main.zig index 1caa613..e13315d 100644 --- a/river/main.zig +++ b/river/main.zig @@ -63,7 +63,7 @@ pub fn main() anyerror!void { } if (result.boolFlag("-version")) { - try io.getStdOut().writeAll(build_options.version); + try io.getStdOut().writeAll(build_options.version ++ "\n"); os.exit(0); } if (result.argFlag("-log-level")) |level_str| { diff --git a/riverctl/main.zig b/riverctl/main.zig index 624f076..63ec331 100644 --- a/riverctl/main.zig +++ b/riverctl/main.zig @@ -78,7 +78,7 @@ fn _main() !void { os.exit(0); } if (result.boolFlag("-version")) { - try io.getStdOut().writeAll(@import("build_options").version); + try io.getStdOut().writeAll(@import("build_options").version ++ "\n"); os.exit(0); } diff --git a/rivertile/main.zig b/rivertile/main.zig index 19857c3..9a8b2f0 100644 --- a/rivertile/main.zig +++ b/rivertile/main.zig @@ -332,7 +332,7 @@ pub fn main() !void { if (result.args.len != 0) fatalPrintUsage("unknown option '{s}'", .{result.args[0]}); if (result.boolFlag("-version")) { - try std.io.getStdOut().writeAll(@import("build_options").version); + try std.io.getStdOut().writeAll(@import("build_options").version ++ "\n"); os.exit(0); } if (result.argFlag("-view-padding")) |raw| {