File tree Expand file tree Collapse file tree
vscode-extensions/playwright-local-browser-server-vscode-extension/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ async function writeExtensionInstalledFileAsync(terminal: ITerminal): Promise<vo
4242 // If on a remote environment, write a file to os.tempdir() using workspace fs
4343
4444 let fileUri : vscode . Uri ;
45+ let tempDir : string ;
4546
4647 if ( vscode . env . remoteName ) {
4748 const markerPrefix : string = '<<<TEMPDIR_START>>>' ;
@@ -52,10 +53,13 @@ async function writeExtensionInstalledFileAsync(terminal: ITerminal): Promise<vo
5253 terminal
5354 } ) ;
5455
55- const tempDir : string = output . slice (
56- output . indexOf ( markerPrefix ) + markerPrefix . length ,
57- output . indexOf ( markerSuffix )
58- ) ;
56+ const startIndex : number = output . indexOf ( markerPrefix ) ;
57+ const endIndex : number = output . indexOf ( markerSuffix ) ;
58+ if ( startIndex !== - 1 && endIndex !== - 1 && endIndex > startIndex ) {
59+ tempDir = output . substring ( startIndex + markerPrefix . length , endIndex ) . trim ( ) ;
60+ } else {
61+ throw new Error ( 'Failed to parse temp directory from command output' ) ;
62+ }
5963
6064 // For remote environments, use the vscode-remote scheme
6165 // The workspace folder should have the correct scheme already
You can’t perform that action at this time.
0 commit comments