Skip to content

Commit 5623089

Browse files
fix(server): disable color probes in worktree setup (pingdotgg#11843)
1 parent a62e7d6 commit 5623089

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

‎apps/server/src/project/ProjectSetupScriptRunner.test.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,12 @@ describe("ProjectSetupScriptRunner", () => {
112112
terminalId: "setup-default-setup",
113113
cwd: "/repo/worktrees/a",
114114
worktreePath: "/repo/worktrees/a",
115-
env: { T3CODE_PROJECT_ROOT: "/repo/project", T3CODE_WORKTREE_PATH: "/repo/worktrees/a" },
115+
env: {
116+
T3CODE_PROJECT_ROOT: "/repo/project",
117+
T3CODE_WORKTREE_PATH: "/repo/worktrees/a",
118+
NO_COLOR: "1",
119+
FORCE_COLOR: "0",
120+
},
116121
});
117122
expect(write).toHaveBeenCalledWith({
118123
threadId: "thread-1",
@@ -211,6 +216,8 @@ describe("ProjectSetupScriptRunner", () => {
211216
cwd: "/repo/worktrees/a",
212217
worktreePath: "/repo/worktrees/a",
213218
env: {
219+
NO_COLOR: "1",
220+
FORCE_COLOR: "0",
214221
T3CODE_PROJECT_ROOT: "/repo/project",
215222
T3CODE_WORKTREE_PATH: "/repo/worktrees/a",
216223
},

‎apps/server/src/project/ProjectSetupScriptRunner.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ export const make = Effect.gen(function* () {
361361
terminalId,
362362
cwd,
363363
worktreePath: input.worktreePath,
364-
env,
364+
// Setup may run before a terminal client attaches to answer color probes.
365+
env: { ...env, NO_COLOR: "1", FORCE_COLOR: "0" },
365366
})
366367
.pipe(
367368
Effect.mapError(

‎apps/server/src/terminal/Manager.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,13 +1934,15 @@ it.layer(
19341934

19351935
it.effect("injects runtime env overrides into spawned terminals", () =>
19361936
Effect.gen(function* () {
1937-
const { manager, ptyAdapter } = yield* createManager();
1937+
const { manager, ptyAdapter } = yield* createManager(5, { env: { FORCE_COLOR: "3" } });
19381938
yield* manager.open(
19391939
openInput({
19401940
env: {
19411941
T3CODE_PROJECT_ROOT: "/repo",
19421942
T3CODE_WORKTREE_PATH: "/repo/worktree-a",
19431943
CUSTOM_FLAG: "1",
1944+
NO_COLOR: "1",
1945+
FORCE_COLOR: "0",
19441946
},
19451947
}),
19461948
);
@@ -1951,6 +1953,8 @@ it.layer(
19511953
assert.equal(spawnInput.env.T3CODE_PROJECT_ROOT, "/repo");
19521954
assert.equal(spawnInput.env.T3CODE_WORKTREE_PATH, "/repo/worktree-a");
19531955
assert.equal(spawnInput.env.CUSTOM_FLAG, "1");
1956+
assert.equal(spawnInput.env.NO_COLOR, "1");
1957+
assert.equal(spawnInput.env.FORCE_COLOR, "0");
19541958
}),
19551959
);
19561960

0 commit comments

Comments
 (0)