@@ -178,23 +178,30 @@ export class IOSDeviceDebugService extends DebugServiceBase implements IDeviceDe
178
178
const existingTcpProxy = this . $appDebugSocketProxyFactory . getTCPSocketProxy ( this . deviceIdentifier , debugData . applicationIdentifier ) ;
179
179
const tcpSocketProxy = existingTcpProxy || await this . $appDebugSocketProxyFactory . addTCPSocketProxy ( this . device , debugData . applicationIdentifier ) ;
180
180
if ( ! existingTcpProxy ) {
181
- await this . openAppInspector ( tcpSocketProxy . address ( ) , debugData , debugOptions ) ;
181
+ const inspectorProcess = await this . openAppInspector ( tcpSocketProxy . address ( ) , debugData , debugOptions ) ;
182
+ if ( inspectorProcess ) {
183
+ tcpSocketProxy . on ( "close" , async ( ) => {
184
+ await this . killProcess ( inspectorProcess ) ;
185
+ } ) ;
186
+ }
182
187
}
183
188
184
189
return null ;
185
190
}
186
191
187
- private async openAppInspector ( fileDescriptor : string , debugData : IDebugData , debugOptions : IDebugOptions ) : Promise < void > {
192
+ private async openAppInspector ( fileDescriptor : string , debugData : IDebugData , debugOptions : IDebugOptions ) : Promise < ChildProcess > {
188
193
if ( debugOptions . client ) {
189
194
const inspectorPath = await this . $packageInstallationManager . getInspectorFromCache ( inspectorNpmPackageName , debugData . projectDir ) ;
190
195
191
196
const inspectorSourceLocation = path . join ( inspectorPath , inspectorUiDir , "Main.html" ) ;
192
- const inspectorApplicationPath = path . join ( inspectorPath , inspectorAppName ) ;
197
+ const inspectorApplicationPath = path . join ( inspectorPath , inspectorAppName , "Contents" , "MacOS" , inspectorAppName , "Contents" , "MacOS" , "NativeScript Inspector" ) ;
193
198
194
- const cmd = `open -a '${ inspectorApplicationPath } ' --args '${ inspectorSourceLocation } ' '${ debugData . projectName } ' '${ fileDescriptor } '` ;
195
- await this . $childProcess . exec ( cmd ) ;
199
+ const inspectorProcess : ChildProcess = this . $childProcess . spawn ( inspectorApplicationPath , [ inspectorSourceLocation , debugData . projectName , fileDescriptor ] ) ;
200
+ inspectorProcess . on ( "error" , ( e : Error ) => this . $logger . trace ( e ) ) ;
201
+ return inspectorProcess ;
196
202
} else {
197
203
this . $logger . info ( "Suppressing debugging client." ) ;
204
+ return null ;
198
205
}
199
206
}
200
207
}
0 commit comments