Skip to content

Commit 786fe30

Browse files
FatmeFatme
authored andcommitted
Merge pull request #40 from telerik/fatme/kill-simulator
Kill simulator only when current booted device is different from selected device to run
2 parents 171af5f + 1f07c77 commit 786fe30

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/iphone-simulator-xcode-7.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export class XCode7Simulator implements ISimulator {
4141
public run(applicationPath: string, applicationIdentifier: string): IFuture<void> {
4242
return (() => {
4343
let device = this.getDeviceToRun().wait();
44+
let currentBootedDevice = _.find(this.getDevices().wait(), device => this.isDeviceBooted(device));
45+
if(currentBootedDevice && (currentBootedDevice.name.toLowerCase() !== device.name.toLowerCase() || currentBootedDevice.runtimeVersion !== device.runtimeVersion)) {
46+
this.killSimulator().wait();
47+
}
4448

4549
if(!this.isDeviceBooted(device)) {
4650
this.startSimulator(device).wait();
@@ -118,4 +122,8 @@ export class XCode7Simulator implements ISimulator {
118122
childProcess.spawn("open", args).wait();
119123
}).future<void>()();
120124
}
125+
126+
private killSimulator(): IFuture<any> {
127+
return childProcess.spawn("pkill", ["-9", "-f", "Simulator"]);
128+
}
121129
}

0 commit comments

Comments
 (0)