@@ -10,6 +10,7 @@ import { mkdir } from 'fs';
1010import { promisify } from 'util' ;
1111import { IDriver , IDisposable } from './driver' ;
1212import { URI } from 'vscode-uri' ;
13+ import * as kill from 'tree-kill' ;
1314
1415const width = 1200 ;
1516const height = 800 ;
@@ -93,6 +94,7 @@ let workspacePath: string | undefined;
9394
9495export async function launch ( userDataDir : string , _workspacePath : string , codeServerPath = process . env . VSCODE_REMOTE_SERVER_PATH ) : Promise < void > {
9596 workspacePath = _workspacePath ;
97+
9698 const agentFolder = userDataDir ;
9799 await promisify ( mkdir ) ( agentFolder ) ;
98100 const env = {
@@ -121,7 +123,7 @@ export async function launch(userDataDir: string, _workspacePath: string, codeSe
121123
122124function teardown ( ) : void {
123125 if ( server ) {
124- server . kill ( ) ;
126+ kill ( server . pid ) ;
125127 server = undefined ;
126128 }
127129}
@@ -137,13 +139,9 @@ function waitForEndpoint(): Promise<string> {
137139 } ) ;
138140}
139141
140- export function connect ( engine : 'chromium' | 'webkit' | 'firefox' = 'chromium' ) : Promise < { client : IDisposable , driver : IDriver } > {
142+ export function connect ( browserType : 'chromium' | 'webkit' | 'firefox' = 'chromium' ) : Promise < { client : IDisposable , driver : IDriver } > {
141143 return new Promise ( async ( c ) => {
142- const browser = await playwright [ engine ] . launch ( {
143- // Run in Edge dev on macOS
144- // executablePath: '/Applications/Microsoft\ Edge\ Dev.app/Contents/MacOS/Microsoft\ Edge\ Dev',
145- headless : false
146- } ) ;
144+ const browser = await playwright [ browserType ] . launch ( { headless : false , dumpio : true } ) ;
147145 const context = await browser . newContext ( ) ;
148146 const page = await context . newPage ( ) ;
149147 await page . setViewportSize ( { width, height } ) ;
0 commit comments