Skip to content

Commit a54e5dc

Browse files
author
John Doe
committed
refactor: add env and cwd to logger in execProcess
1 parent 804319b commit a54e5dc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/utils/src/lib/execute-process.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ export function executeProcess(cfg: ProcessConfig): Promise<ProcessResult> {
159159
observer,
160160
ignoreExitCode = false,
161161
env,
162+
cwd,
162163
...options
163164
} = cfg;
164165
const { onStdout, onStderr, onError, onComplete } = observer ?? {};
@@ -173,7 +174,8 @@ export function executeProcess(cfg: ProcessConfig): Promise<ProcessResult> {
173174
// shell:true tells Windows to use shell command for spawning a child process
174175
// https://stackoverflow.com/questions/60386867/node-spawn-child-process-not-working-in-windows
175176
shell: true,
176-
windowsHide: true,
177+
...(env && { env: env as Record<string, string> }),
178+
...(cwd && { cwd: cwd as string }),
177179
...options,
178180
}) as ChildProcessByStdio<Writable, Readable, Readable>;
179181

@@ -218,6 +220,7 @@ export function executeProcess(cfg: ProcessConfig): Promise<ProcessResult> {
218220
});
219221
}),
220222
{
223+
...(cwd && { cwd: cwd as string }),
221224
...(env ? { env: env as Record<string, string> } : {}),
222225
},
223226
);

0 commit comments

Comments
 (0)