@@ -32,15 +32,15 @@ export class Simctl implements ISimctl {
32
32
}
33
33
34
34
public install ( deviceId : string , applicationPath : string ) : void {
35
- return this . simctlExec ( "install" , [ deviceId , applicationPath ] ) ;
35
+ this . simctlExec ( "install" , [ deviceId , applicationPath ] ) ;
36
36
}
37
37
38
38
public uninstall ( deviceId : string , appIdentifier : string , opts ?: any ) : void {
39
- return this . simctlExec ( "uninstall" , [ deviceId , appIdentifier ] , opts ) ;
39
+ this . simctlExec ( "uninstall" , [ deviceId , appIdentifier ] , opts ) ;
40
40
}
41
41
42
42
public notifyPost ( deviceId : string , notification : string ) : void {
43
- return this . simctlExec ( "notify_post" , [ deviceId , notification ] ) ;
43
+ this . simctlExec ( "notify_post" , [ deviceId , notification ] ) ;
44
44
}
45
45
46
46
public getAppContainer ( deviceId : string , appIdentifier : string ) : string {
@@ -120,11 +120,20 @@ export class Simctl implements ISimctl {
120
120
return devices ;
121
121
}
122
122
123
- private simctlExec ( command : string , args : string [ ] , opts ?: any ) : any {
124
- let result = childProcess . spawnSync ( "xcrun" , [ "simctl" , command ] . concat ( args ) , opts ) ;
125
- if ( result && result . stdout ) {
126
- return result . stdout . toString ( ) . trim ( ) ;
123
+ private simctlExec ( command : string , args : string [ ] , opts ?: any ) : string {
124
+ const result = childProcess . spawnSync ( "xcrun" , [ "simctl" , command ] . concat ( args ) , opts ) ;
125
+ if ( result ) {
126
+ if ( result . signal ) {
127
+ // In some cases, sending Ctrl + C (SIGINT) is handled by the simctl itself and spawnSync finishes, but the SIGINT does not stop current process.
128
+ // In order to ensure the same signal is sent to the caller (CLI for example), send the signal manually:
129
+ process . send ( result . signal ) ;
130
+ }
131
+
132
+ if ( result . stdout ) {
133
+ return result . stdout . toString ( ) . trim ( ) ;
134
+ }
127
135
}
136
+
128
137
return '' ;
129
138
}
130
139
}
0 commit comments