shell-integration: avoid owning temporary commands

Some shell setup functions previously converted their stack-backed
command builders to owned sentinel slices before duplicating them into
the result arena. Duplicate the builders' written bytes directly
instead, avoiding unnecessary ownership transfer and sentinel handling.
This commit is contained in:
Jon Parise
2026-08-19 17:45:14 -04:00
parent a4edca2a90
commit 8e8d76b634

View File

@@ -407,7 +407,7 @@ fn setupBash(
}
// Return a copy of our modified command line to use as the shell command.
return .{ .shell = try alloc.dupeZ(u8, try cmd.toOwnedSlice()) };
return .{ .shell = try alloc.dupeZ(u8, cmd.buffer.written()) };
}
test "bash" {
@@ -839,7 +839,7 @@ fn setupNushell(
}
// Return a copy of our modified command line to use as the shell command.
return .{ .shell = try alloc.dupeZ(u8, try cmd.toOwnedSlice()) };
return .{ .shell = try alloc.dupeZ(u8, cmd.buffer.written()) };
}
test "nushell" {