Skip to content

Commit

Permalink
build: fix trailing newline in version string
Browse files Browse the repository at this point in the history
  • Loading branch information
ifreund committed Nov 2, 2021
1 parent d4aa640 commit 69d1453
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion river/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down
2 changes: 1 addition & 1 deletion riverctl/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion rivertile/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down

0 comments on commit 69d1453

Please sign in to comment.