11import path from 'path'
22import { 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
76export 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-
3936export 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