Skip to content

Commit 4829f58

Browse files
committed
[openApiDiff.ts] Use execFile for dotnet
1 parent 01bb2f0 commit 4829f58

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/lib/validators/openApiDiff.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { ResolveSwagger } from "../util/resolveSwagger"
1818
import { pathToJsonPointer } from "../util/utils"
1919
const _ = require("lodash")
2020

21-
const exec = util.promisify(child_process.exec)
21+
const execFile = util.promisify(child_process.execFile)
2222

2323
export type Options = {
2424
readonly consoleLogLevel?: unknown
@@ -319,10 +319,10 @@ export class OpenApiDiff {
319319
throw new Error(`File "${newSwagger}" not found.`)
320320
}
321321

322-
const cmd = `${this.dotNetPath()} ${this.openApiDiffDllPath()} -o ${oldSwagger} -n ${newSwagger}`
322+
const [file, args] = [this.dotNetPath(), [this.openApiDiffDllPath(), "-o", oldSwagger, "-n", newSwagger]];
323323

324-
log.debug(`Executing: "${cmd}"`)
325-
const { stdout } = await exec(cmd, { encoding: "utf8", maxBuffer: 1024 * 1024 * 64 })
324+
log.debug(`Executing: "${file} ${args.join(' ')}"`)
325+
const { stdout } = await execFile(file, args, { encoding: "utf8", maxBuffer: 1024 * 1024 * 64 })
326326
const resultJson = JSON.parse(stdout) as Messages
327327

328328
const updatedJson = resultJson.map(message => ({

0 commit comments

Comments
 (0)