Skip to content

Commit 279a6be

Browse files
committed
finish migration
1 parent b789af9 commit 279a6be

File tree

10 files changed

+19
-15
lines changed

10 files changed

+19
-15
lines changed

packages/core/src/shared/extensions/git.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as vscode from 'vscode'
77
import * as GitTypes from '../../../types/git.d'
88
import { SemVer, parse as semverParse } from 'semver'
9-
import { execFile } from 'child_process'
9+
import { execFile } from 'child_process' // eslint-disable-line no-restricted-imports
1010
import { promisify } from 'util'
1111
import { VSCODE_EXTENSION_ID } from '../extensions'
1212
import { makeTemporaryToolkitFolder, tryRemoveFolder } from '../filesystemUtilities'

packages/core/src/shared/sam/cli/samCliInvokerUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { SpawnOptions } from 'child_process'
6+
import { SpawnOptions } from 'child_process' // eslint-disable-line no-restricted-imports
77
import { getLogger } from '../../logger'
88
import { getUserAgent } from '../../telemetry/util'
99
import { ChildProcessResult, ChildProcessOptions } from '../../utilities/processUtils'

packages/core/src/shared/sam/cli/samCliLocalInvoke.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { SpawnOptions } from 'child_process'
6+
import { SpawnOptions } from 'child_process' // eslint-disable-line no-restricted-imports
77
import { pushIf } from '../../utilities/collectionUtils'
88
import * as nls from 'vscode-nls'
99
import { getLogger, getDebugConsoleLogger, Logger } from '../../logger'

packages/core/src/shared/sam/debugger/goSamDebug.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { getLogger } from '../../logger'
1818
import fs from '../../fs/fs'
1919
import { ChildProcess } from '../../utilities/processUtils'
2020
import { Timeout } from '../../utilities/timeoutUtils'
21-
import { execFileSync, SpawnOptions } from 'child_process'
21+
import { SpawnOptions } from 'child_process' // eslint-disable-line no-restricted-imports
2222
import * as nls from 'vscode-nls'
2323
import { sleep } from '../../utilities/timeoutUtils'
2424
import 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
}

packages/core/src/shared/utilities/processUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import * as proc from 'child_process'
6+
import * as proc from 'child_process' // eslint-disable-line no-restricted-imports
77
import * as crossSpawn from 'cross-spawn'
88
import * as logger from '../logger'
99
import { Timeout, CancellationError, waitUntil } from './timeoutUtils'

packages/core/src/test/shared/sam/cli/samCliBuild.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import assert from 'assert'
7-
import { SpawnOptions } from 'child_process'
7+
import { SpawnOptions } from 'child_process' // eslint-disable-line no-restricted-imports
88
import * as path from 'path'
99
import { makeTemporaryToolkitFolder } from '../../../../shared/filesystemUtilities'
1010
import { makeUnexpectedExitCodeError } from '../../../../shared/sam/cli/samCliInvokerUtils'

packages/core/src/test/shared/sam/cli/samCliInit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import assert from 'assert'
7-
import { SpawnOptions } from 'child_process'
7+
import { SpawnOptions } from 'child_process' // eslint-disable-line no-restricted-imports
88
import {
99
eventBridgeStarterAppTemplate,
1010
getSamCliTemplateParameter,

packages/core/src/test/shared/sam/cli/testSamCliProcessInvoker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import assert from 'assert'
7-
import { SpawnOptions } from 'child_process'
7+
import { SpawnOptions } from 'child_process' // eslint-disable-line no-restricted-imports
88

99
import { isError } from 'lodash'
1010
import {

packages/core/src/testInteg/shared/extensions/git.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as GitTypes from '../../../../types/git'
1010
import { GitExtension, Repository } from '../../../shared/extensions/git'
1111
import { makeTemporaryToolkitFolder } from '../../../shared/filesystemUtilities'
1212
import { realpathSync } from 'fs' // eslint-disable-line no-restricted-imports
13-
import { execFileSync } from 'child_process'
13+
import { execFileSync } from 'child_process' // eslint-disable-line no-restricted-imports
1414
import { sleep } from '../../../shared/utilities/timeoutUtils'
1515
import { getLogger } from '../../../shared/logger/logger'
1616
import { getMinVscodeVersion } from '../../../shared/vscode/env'

packages/core/src/testLint/testUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { SpawnSyncOptions, spawnSync } from 'child_process'
6+
import { SpawnSyncOptions, spawnSync } from 'child_process' // eslint-disable-line no-restricted-imports
77

88
export function runCmd(args: string[], options?: SpawnSyncOptions & { throws?: boolean }) {
99
const result = spawnSync(args[0], args.slice(1), options)

0 commit comments

Comments
 (0)