From f705fe6cf20e0d987998b9fc61831a0381d2ca30 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 5 Nov 2023 11:23:14 -0800 Subject: [PATCH] termio: initialize pwd before subprocess starts Fixes #807 --- src/termio/Exec.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/termio/Exec.zig b/src/termio/Exec.zig index 6db769dc6..55b0e0dff 100644 --- a/src/termio/Exec.zig +++ b/src/termio/Exec.zig @@ -143,6 +143,13 @@ pub fn init(alloc: Allocator, opts: termio.Options) !Exec { var subprocess = try Subprocess.init(alloc, opts); errdefer subprocess.deinit(); + // If we have an initial pwd requested by the subprocess, then we + // set that on the terminal now. This allows rapidly initializing + // new surfaces to use the proper pwd. + if (subprocess.cwd) |cwd| term.setPwd(cwd) catch |err| { + log.warn("error setting initial pwd err={}", .{err}); + }; + // Initial width/height based on subprocess term.width_px = subprocess.screen_size.width; term.height_px = subprocess.screen_size.height;