From bac4776c0c608b43e53d9ee9f7b6e75400bbd35e Mon Sep 17 00:00:00 2001 From: Maxwell Brown Date: Tue, 28 Jul 2026 17:42:09 -0400 Subject: [PATCH] Document ChildProcess environment behavior --- .changeset/document-child-process-env.md | 5 +++++ packages/effect/src/unstable/process/ChildProcess.ts | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .changeset/document-child-process-env.md diff --git a/.changeset/document-child-process-env.md b/.changeset/document-child-process-env.md new file mode 100644 index 00000000000..f28d7288161 --- /dev/null +++ b/.changeset/document-child-process-env.md @@ -0,0 +1,5 @@ +--- +"effect": patch +--- + +Document that `CommandOptions.extendEnv` defaults to `false` and that providing `env` without enabling it replaces the inherited child environment. diff --git a/packages/effect/src/unstable/process/ChildProcess.ts b/packages/effect/src/unstable/process/ChildProcess.ts index 32b8ba29aad..f0a110e4237 100644 --- a/packages/effect/src/unstable/process/ChildProcess.ts +++ b/packages/effect/src/unstable/process/ChildProcess.ts @@ -383,6 +383,11 @@ export interface CommandOptions extends KillOptions { * If `extendEnv` is set to `true`, the value of `env` will be merged with * the value of `globalThis.process.env`, prioritizing the values in `env` * when conflicts exist. + * + * **Gotchas** + * + * Without `extendEnv: true`, providing `env` replaces the inherited child + * environment. The child will not receive `PATH` unless `env` includes it. */ readonly env?: Record | undefined /** @@ -392,7 +397,9 @@ export interface CommandOptions extends KillOptions { * * **Details** * - * If set to `false`, only the value of `env` is used. + * If set to `false` and `env` is provided, only the value of `env` is used. + * + * @default false */ readonly extendEnv?: boolean | undefined /**