@@ -20,32 +20,34 @@ export class ControlSocket {
2020 this . supportedPlatform ( ) &&
2121 initPacket . engineName === 'Xdebug' &&
2222 semver . valid ( initPacket . engineVersion , { loose : true } ) !== null &&
23- ( semver . gte ( initPacket . engineVersion , '3.4.0' , { loose : true } ) || initPacket . engineVersion === '3.4.0-dev' )
23+ ( semver . gte ( initPacket . engineVersion , '3.4.0' , { loose : true } ) ||
24+ initPacket . engineVersion . startsWith ( '3.4.0' ) )
2425 )
2526 }
2627
2728 /**
2829 *
29- * @param pid appId returned in the init packet
30+ * @param ctrlSocket Control socket full path
3031 * @returns
3132 */
32- async requestPause ( pid : string ) : Promise < void > {
33+ async requestPause ( ctrlSocket : string ) : Promise < void > {
3334 let retval
3435 if ( process . platform === 'linux' ) {
35- retval = await this . executeLinux ( pid , 'pause' )
36+ retval = await this . executeLinux ( ctrlSocket , 'pause' )
3637 } else if ( process . platform === 'win32' ) {
37- retval = await this . executeWindows ( pid , 'pause' )
38+ retval = await this . executeWindows ( ctrlSocket , 'pause' )
3839 } else {
3940 throw new Error ( 'Invalid platform for Xdebug control socket' )
4041 }
4142 retval
4243 return
4344 }
4445
45- private async executeLinux ( pid : string , cmd : string ) : Promise < string > {
46+ private async executeLinux ( ctrlSocket : string , cmd : string ) : Promise < string > {
4647 const abs = await import ( 'abstract-socket' )
4748 return new Promise < string > ( ( resolve , reject ) => {
48- const cs = `\0xdebug-ctrl.${ pid } y` . padEnd ( 108 , 'x' )
49+ // const cs = `\0xdebug-ctrl.${pid}y`.padEnd(108, 'x')
50+ const cs = `\0${ ctrlSocket } `
4951 try {
5052 const s = abs . connect ( cs , ( ) => {
5153 s . write ( `${ cmd } \0` )
@@ -81,9 +83,10 @@ export class ControlSocket {
8183 } )
8284 }
8385
84- private async executeWindows ( pid : string , cmd : string ) : Promise < string > {
86+ private async executeWindows ( ctrlSocket : string , cmd : string ) : Promise < string > {
8587 return new Promise < string > ( ( resolve , reject ) => {
86- const s = net . createConnection ( `\\\\.\\pipe\\xdebug-ctrl.${ pid } ` , ( ) => {
88+ //const s = net.createConnection(`\\\\.\\pipe\\xdebug-ctrl.${pid}`, () => {
89+ const s = net . createConnection ( ctrlSocket , ( ) => {
8790 s . end ( `${ cmd } \0` )
8891 } )
8992 s . setTimeout ( 3000 )
0 commit comments