Skip to content

Commit

Permalink
fix(dotnet): try to resolve security hotsopt on execSync
Browse files Browse the repository at this point in the history
  • Loading branch information
asinino committed Mar 3, 2022
1 parent a3bae30 commit f3ddb86
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/dotnet/src/lib/core/dotnet.client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getParameterArrayStrings, swapKeysUsingMap } from '@nx-dotnet/utils';
import { ChildProcess, execSync, spawn } from 'child_process';
import { ChildProcess, spawn, spawnSync } from 'child_process';

import {
addPackageKeyMap,
Expand Down Expand Up @@ -160,10 +160,15 @@ export class DotNetClient {
}

private execute(params: string[]): Buffer {
return execSync([this.cliCommand.command, ...params].join(' '), {
return spawnSync(this.cliCommand.command, params, {
stdio: 'inherit',
cwd: this.cwd || process.cwd(),
});
})
.output.filter((buf) => buf !== null)
.reduce(
(acc, buf) => Buffer.concat([acc as Buffer, buf as Buffer]),
Buffer.from(''),
) as Buffer;
}

private logAndSpawn(params: string[]): ChildProcess {
Expand Down

0 comments on commit f3ddb86

Please sign in to comment.