From 8e8d76b634f1b791fd693715fc56d728b4967dab Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Wed, 19 Aug 2026 17:45:14 -0400 Subject: [PATCH] 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. --- src/termio/shell_integration.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/termio/shell_integration.zig b/src/termio/shell_integration.zig index c23ff9ad9..d56a84ccb 100644 --- a/src/termio/shell_integration.zig +++ b/src/termio/shell_integration.zig @@ -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" {