src/goToolPprof: execFile instead of exec Fixes golang/vscode-go#1779 Change-Id: I6e5f6f91cac34c2d0195cb4f4fd564da840b7643 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/350739 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Trust: Robert Findley <rfindley@google.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/src/goToolPprof.ts b/src/goToolPprof.ts index ef1bc91..d947006 100644 --- a/src/goToolPprof.ts +++ b/src/goToolPprof.ts
@@ -2,7 +2,7 @@ * Copyright 2021 The Go Authors. All rights reserved. * Licensed under the MIT License. See LICENSE in the project root for license information. *--------------------------------------------------------*/ -import { exec } from 'child_process'; +import { execFile } from 'child_process'; import { window, CancellationToken, TextDocumentContentProvider, Uri } from 'vscode'; import { outputChannel } from './goStatus'; import { getBinPath } from './util'; @@ -15,7 +15,7 @@ private pprof(uri: Uri, token: CancellationToken) { const goBin = getBinPath('go'); return new Promise<string | undefined>((resolve) => { - const cp = exec(`${goBin} tool pprof -tree ${uri.fsPath}`, async (err, stdout, stderr) => { + const cp = execFile(goBin, ['tool', 'pprof', '-tree', uri.fsPath], async (err, stdout, stderr) => { if (err || stderr) { const m = 'Failed to execute `go tool pprof`'; if (err) outputChannel.appendLine(`${m}: ${err}`);