@@ -18,7 +18,7 @@ import { getLogger } from '../../logger'
1818import fs from '../../fs/fs'
1919import { ChildProcess } from '../../utilities/processUtils'
2020import { Timeout } from '../../utilities/timeoutUtils'
21- import { execFileSync , SpawnOptions } from 'child_process'
21+ import { SpawnOptions } from 'child_process' // eslint-disable-line no-restricted-imports
2222import * as nls from 'vscode-nls'
2323import { sleep } from '../../utilities/timeoutUtils'
2424import globals from '../../extensionGlobals'
@@ -174,9 +174,11 @@ async function makeInstallScript(debuggerPath: string, isWindows: boolean): Prom
174174 // Go from trying to find the manifest file and uses GOPATH provided below.
175175 installOptions . env ! [ 'GO111MODULE' ] = 'off'
176176
177- function getDelveVersion ( repo : string , silent : boolean ) : string {
177+ async function getDelveVersion ( repo : string , silent : boolean ) : Promise < string > {
178178 try {
179- return execFileSync ( 'git' , [ '-C' , repo , 'describe' , '--tags' , '--abbrev=0' ] ) . toString ( ) . trim ( )
179+ return (
180+ await ChildProcess . exec ( 'git' , [ '-C' , repo , 'describe' , '--tags' , '--abbrev=0' ] , { collect : true } )
181+ ) . stdout . trim ( )
180182 } catch ( e ) {
181183 if ( ! silent ) {
182184 throw e
@@ -187,7 +189,9 @@ async function makeInstallScript(debuggerPath: string, isWindows: boolean): Prom
187189
188190 // It's fine if we can't get the latest Delve version, the Toolkit will use the last built one instead
189191 try {
190- const goPath : string = JSON . parse ( execFileSync ( 'go' , [ 'env' , '-json' ] ) . toString ( ) ) . GOPATH
192+ const goPath : string = JSON . parse (
193+ ( await ChildProcess . exec ( 'go' , [ 'env' , '-json' ] , { collect : true } ) ) . stdout
194+ ) . GOPATH
191195 let repoPath : string = path . join ( goPath , 'src' , delveRepo )
192196
193197 if ( ! getDelveVersion ( repoPath , true ) ) {
@@ -200,11 +204,11 @@ async function makeInstallScript(debuggerPath: string, isWindows: boolean): Prom
200204 installOptions . env ! [ 'GOPATH' ] = debuggerPath
201205 repoPath = path . join ( debuggerPath , 'src' , delveRepo )
202206 const args = [ 'get' , '-d' , `${ delveRepo } /cmd/dlv` ]
203- const out = execFileSync ( 'go' , args , installOptions as any )
207+ const out = await ChildProcess . exec ( 'go' , args , { ... ( installOptions as any ) , collect : true } )
204208 getLogger ( ) . debug ( '"go %O": %s' , args , out )
205209 }
206210
207- delveVersion = getDelveVersion ( repoPath , false )
211+ delveVersion = await getDelveVersion ( repoPath , false )
208212 } catch ( e ) {
209213 getLogger ( ) . debug ( 'Failed to get latest Delve version: %O' , e as Error )
210214 }
0 commit comments