Skip to content

Commit

Permalink
Only pass env variable to child process
Browse files Browse the repository at this point in the history
  • Loading branch information
Amplifiyer committed Nov 16, 2023
1 parent 2aecc08 commit bb7f2bd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/backend-deployer/src/cdk_deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,15 @@ export class CDKDeployer implements BackendDeployer {
done();
};

// Piping the output by default strips off the color. This is a workaround to
// preserve the color being piped to parent process. Later we reset it to whatever it was before.
const oldForceColorValue = process.env['FORCE_COLOR'];
process.env['FORCE_COLOR'] = '1';
const childProcess = execa(command, cdkCommandArgs, {
stdin: 'inherit',
stdout: 'pipe',
stderr: 'pipe',

// Piping the output by default strips off the color. This is a workaround to
// preserve the color being piped to parent process.
extendEnv: true,
env: { FORCE_COLOR: '1' },
});
childProcess.stderr?.pipe(aggregatorStderrStream);
childProcess.stdout?.pipe(process.stdout);
Expand All @@ -189,7 +190,6 @@ export class CDKDeployer implements BackendDeployer {

try {
await childProcess;
process.env['FORCE_COLOR'] = oldForceColorValue;
return cdkOutput;
} catch (error) {
// swallow execa error which is not really helpful, rather throw stderr
Expand Down

0 comments on commit bb7f2bd

Please sign in to comment.