Skip to content

Commit 6c54a49

Browse files
committed
chore(vscode): move to better exec async
1 parent f33beb6 commit 6c54a49

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

vscode/extension/tests/utils.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import path from 'path'
22
import { Page } from '@playwright/test'
3-
import { exec } from 'child_process'
4-
import { promisify } from 'util'
3+
import { execAsync } from '../src/utilities/exec'
54

65
// Where your extension lives on disk
76
export const EXT_PATH = path.resolve(__dirname, '..')
@@ -34,8 +33,6 @@ export const clickExplorerTab = async (page: Page): Promise<void> => {
3433
}
3534
}
3635

37-
const execAsync = promisify(exec)
38-
3936
export interface PythonEnvironment {
4037
pythonPath: string
4138
pipPath: string
@@ -49,8 +46,10 @@ export const createVirtualEnvironment = async (
4946
venvDir: string,
5047
): Promise<PythonEnvironment> => {
5148
const pythonCmd = process.platform === 'win32' ? 'python' : 'python3'
52-
const { stderr } = await execAsync(`${pythonCmd} -m venv "${venvDir}"`)
53-
if (stderr && !stderr.includes('WARNING')) {
49+
const { stderr, exitCode } = await execAsync(
50+
`${pythonCmd} -m venv "${venvDir}"`,
51+
)
52+
if (exitCode !== 0) {
5453
throw new Error(`Failed to create venv: ${stderr}`)
5554
}
5655
// Get paths
@@ -76,8 +75,8 @@ export const pipInstall = async (
7675
): Promise<void> => {
7776
const { pipPath } = pythonDetails
7877
const execString = `"${pipPath}" install -e "${packagePaths.join('" -e "')}"`
79-
const { stderr } = await execAsync(execString)
80-
if (stderr && !stderr.includes('WARNING') && !stderr.includes('notice')) {
78+
const { stderr, exitCode } = await execAsync(execString)
79+
if (exitCode !== 0) {
8180
throw new Error(`Failed to install package: ${stderr}`)
8281
}
8382
}

0 commit comments

Comments
 (0)