botholomew 0.20.0 → 0.20.1
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.
- package/package.json +1 -1
- package/src/worker/spawn.ts +19 -1
package/package.json
CHANGED
package/src/worker/spawn.ts
CHANGED
|
@@ -11,6 +11,24 @@ export interface SpawnWorkerOptions {
|
|
|
11
11
|
taskId?: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Env for a detached worker whose stdout/stderr is a log file: force no ANSI
|
|
16
|
+
* color. `ansis` (and other color libs) read these vars at import time, and
|
|
17
|
+
* `FORCE_COLOR` overrides `NO_COLOR`, so we must remove the forcing vars in
|
|
18
|
+
* addition to setting `NO_COLOR`. Without this, an interactive shell's inherited
|
|
19
|
+
* `FORCE_COLOR`/`COLORTERM` would make ansis emit escape codes into the log file
|
|
20
|
+
* even though the child's stdout is a file, not a TTY.
|
|
21
|
+
*/
|
|
22
|
+
export function colorlessEnv(
|
|
23
|
+
base: Record<string, string | undefined> = process.env,
|
|
24
|
+
): Record<string, string | undefined> {
|
|
25
|
+
const env: Record<string, string | undefined> = { ...base };
|
|
26
|
+
env.NO_COLOR = "1";
|
|
27
|
+
delete env.FORCE_COLOR;
|
|
28
|
+
delete env.CLICOLOR_FORCE;
|
|
29
|
+
return env;
|
|
30
|
+
}
|
|
31
|
+
|
|
14
32
|
/**
|
|
15
33
|
* Spawn a worker as a detached background process. Unlike the old daemon
|
|
16
34
|
* model, multiple workers per project are allowed and expected — this just
|
|
@@ -52,7 +70,7 @@ export async function spawnWorker(
|
|
|
52
70
|
|
|
53
71
|
const proc = Bun.spawn(args, {
|
|
54
72
|
stdio: ["ignore", logFile, logFile],
|
|
55
|
-
env:
|
|
73
|
+
env: colorlessEnv(),
|
|
56
74
|
});
|
|
57
75
|
proc.unref();
|
|
58
76
|
|