@treeport/treeport 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -112,6 +112,7 @@ async function runLaunchSpec(spec, dependencies = {}) {
112
112
  const stdout = dependencies.stdout ?? process.stdout;
113
113
  const stderr = dependencies.stderr ?? process.stderr;
114
114
  const signalSource = dependencies.signalSource ?? process;
115
+ const tmuxPane = dependencies.tmuxPane === void 0 ? process.env.TMUX_PANE : dependencies.tmuxPane ?? void 0;
115
116
  if (spec.setupError) {
116
117
  stderr.write(`[Treeport setup] ${safeDiagnostic(spec.setupError) || "setup preparation failed"}\n`);
117
118
  return 1;
@@ -167,6 +168,21 @@ async function runLaunchSpec(spec, dependencies = {}) {
167
168
  if (result.spawnError) stderr.write(`Treeport launcher: ${safeDiagnostic(result.spawnError.message) || "spawn error"}\n`);
168
169
  if (result.forwardedSignal && (!spec.fallbackArgv || result.forwardedSignal !== "SIGINT")) return 1;
169
170
  if (spec.fallbackArgv) {
171
+ if (spec.tmuxExecutable && tmuxPane && spec.fallbackArgv[0]) await runChild([
172
+ spec.tmuxExecutable,
173
+ "set-option",
174
+ "-p",
175
+ "-t",
176
+ tmuxPane,
177
+ "--",
178
+ "@treeport-fallback-shell",
179
+ Buffer.from(JSON.stringify(spec.fallbackArgv[0]), "utf8").toString("base64url")
180
+ ], {
181
+ cwd: spec.cwd,
182
+ env: process.env,
183
+ spawnProcess,
184
+ signalSource
185
+ });
170
186
  const fallback = integrateShellLaunch(spec.fallbackArgv, commandEnvironment, spec.shellIntegrationDir, spec.tmuxExecutable);
171
187
  const fallbackResult = await runChild(fallback.argv, {
172
188
  cwd: spec.cwd,