Skip to content

Commit 631032d

Browse files
author
Yosif Yosifov
committed
Make killSimulator synchronous -> remove await/async
1 parent 0d596f6 commit 631032d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/iphone-simulator-xcode-simctl.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ export class XCodeSimctlSimulator extends IPhoneSimulatorNameGetter implements I
4040
});
4141
}
4242

43-
public async run(applicationPath: string, applicationIdentifier: string): void {
43+
public run(applicationPath: string, applicationIdentifier: string): void {
4444
let device = this.getDeviceToRun();
4545
let currentBootedDevice = _.find(this.getDevices(), device => this.isDeviceBooted(device));
4646
if (currentBootedDevice && (currentBootedDevice.name.toLowerCase() !== device.name.toLowerCase() || currentBootedDevice.runtimeVersion !== device.runtimeVersion)) {
47-
await this.killSimulator();
47+
this.killSimulator();
4848
}
4949

5050
this.startSimulator(device);
@@ -145,23 +145,23 @@ export class XCodeSimctlSimulator extends IPhoneSimulatorNameGetter implements I
145145
return _.find(devices, device => this.isDeviceBooted(device));
146146
}
147147

148-
public async startSimulator(device?: IDevice): void {
148+
public startSimulator(device?: IDevice): void {
149149
device = device || this.getDeviceToRun();
150150
if (!this.isDeviceBooted(device)) {
151151
let bootedDevice = this.getBootedDevice();
152152
if(bootedDevice && bootedDevice.id !== device.id) {
153-
await this.killSimulator();
153+
this.killSimulator();
154154
}
155155

156156
common.startSimulator(device.id);
157157
// startSimulaltor doesn't always finish immediately, and the subsequent
158158
// install fails since the simulator is not running.
159159
// Give it some time to start before we attempt installing.
160-
utils.sleep(1000);
160+
utils.sleep(1000);
161161
}
162162
}
163-
164-
private async killSimulator(): Promise<any> {
165-
return childProcess.spawn("pkill", ["-9", "-f", "Simulator"]);
163+
164+
private killSimulator(): Promise<any> {
165+
childProcess.execSync("pkill -9 -f Simulator");
166166
}
167167
}

0 commit comments

Comments
 (0)