File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -414,6 +414,11 @@ class PhpDebugSession extends vscode.DebugSession {
414414 throw new Error ( 'Cannot have port and socketPath set at the same time' )
415415 }
416416 if ( args . hostname ?. toLowerCase ( ) ?. startsWith ( 'unix://' ) === true ) {
417+ if ( fs . existsSync ( args . hostname . substring ( 7 ) ) ) {
418+ throw new Error (
419+ `File ${ args . hostname . substring ( 7 ) } exists and cannot be used for Unix Domain socket`
420+ )
421+ }
417422 server . listen ( args . hostname . substring ( 7 ) )
418423 } else if ( args . hostname ?. startsWith ( '\\\\' ) === true ) {
419424 server . listen ( args . hostname )
Original file line number Diff line number Diff line change @@ -92,6 +92,16 @@ describe('PHP Debug Adapter', () => {
9292 client . waitForEvent ( 'terminated' ) ,
9393 ] )
9494 } )
95+ ; ( process . platform === 'win32' ? it . skip : it ) ( 'should error on existing unix pipe' , async ( ) => {
96+ await assert . isRejected (
97+ client . launch ( {
98+ program,
99+ hostname : 'unix:///tmp' ,
100+ runtimeArgs : [ '-dxdebug.client_host=unix:///tmp' ] ,
101+ } ) ,
102+ / F i l e .+ e x i s t s a n d c a n n o t b e u s e d f o r U n i x D o m a i n s o c k e t /
103+ )
104+ } )
95105 } )
96106
97107 describe ( 'continuation commands' , ( ) => {
You can’t perform that action at this time.
0 commit comments