From bc9f884e693280fdb7ea1326f572148d781db145 Mon Sep 17 00:00:00 2001 From: Achieve Date: Wed, 25 Mar 2026 11:54:44 +0800 Subject: [PATCH] Export CMUX_SOCKET alongside CMUX_SOCKET_PATH in terminal env (#1991) * Export CMUX_SOCKET alongside CMUX_SOCKET_PATH in terminal environment The app only exported CMUX_SOCKET_PATH when setting up the terminal environment, but some scripts and hooks (e.g. claude-hook) expect CMUX_SOCKET. The CLI launcher code already exports both (cmux.swift lines 9288-9289), but the app-side terminal setup was missing the alias. This caused claude-hook stop to fail with 'TabManager not available' when CMUX_SOCKET was empty. Fixes #1905 Co-Authored-By: Claude Opus 4.6 (1M context) * Cache socketPath to avoid redundant call Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- Sources/GhosttyTerminalView.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/GhosttyTerminalView.swift b/Sources/GhosttyTerminalView.swift index dd854f7b..32f2b68c 100644 --- a/Sources/GhosttyTerminalView.swift +++ b/Sources/GhosttyTerminalView.swift @@ -3335,7 +3335,10 @@ final class TerminalSurface: Identifiable, ObservableObject { // Backward-compatible shell integration keys used by existing scripts/tests. setManagedEnvironmentValue("CMUX_PANEL_ID", id.uuidString) setManagedEnvironmentValue("CMUX_TAB_ID", tabId.uuidString) - setManagedEnvironmentValue("CMUX_SOCKET_PATH", SocketControlSettings.socketPath()) + let socketPath = SocketControlSettings.socketPath() + setManagedEnvironmentValue("CMUX_SOCKET_PATH", socketPath) + // Backward-compatible alias expected by older scripts and third-party integrations. + setManagedEnvironmentValue("CMUX_SOCKET", socketPath) if let bundledCLIURL = Bundle.main.resourceURL?.appendingPathComponent("bin/cmux"), FileManager.default.isExecutableFile(atPath: bundledCLIURL.path) { setManagedEnvironmentValue("CMUX_BUNDLED_CLI_PATH", bundledCLIURL.path)