Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 3d9b5db

Browse files
committed
Use async API from ios-sim
Fixes NativeScript/nativescript-cli#3545
1 parent 1ea2aa6 commit 3d9b5db

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

appbuilder/providers/device-app-data-provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class IOSAppIdentifier extends AppBuilderDeviceAppDataBase implements ILi
102102
@cache()
103103
public async getDeviceProjectRootPath(): Promise<string> {
104104
if (this.device.isEmulator) {
105-
const applicationPath = this.$iOSSimResolver.iOSSim.getApplicationPath(this.device.deviceInfo.identifier, this.appIdentifier);
105+
const applicationPath = await this.$iOSSimResolver.iOSSim.getApplicationPath(this.device.deviceInfo.identifier, this.appIdentifier);
106106
return path.join(applicationPath, "www");
107107
}
108108

@@ -127,7 +127,7 @@ export class IOSNativeScriptAppIdentifier extends AppBuilderDeviceAppDataBase im
127127
@cache()
128128
public async getDeviceProjectRootPath(): Promise<string> {
129129
if (this.device.isEmulator) {
130-
const applicationPath = this.$iOSSimResolver.iOSSim.getApplicationPath(this.device.deviceInfo.identifier, this.appIdentifier);
130+
const applicationPath = await this.$iOSSimResolver.iOSSim.getApplicationPath(this.device.deviceInfo.identifier, this.appIdentifier);
131131
return applicationPath;
132132
}
133133

definitions/mobile.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ declare module Mobile {
210210
* Starts the process for getting simulator logs and sends collected data to deviceLogProvider, which should decide how to show it to the user.
211211
* @param {string} deviceIdentifier The unique identifier of the device.
212212
*/
213-
startLogProcess(deviceIdentifier: string): void;
213+
startLogProcess(deviceIdentifier: string): Promise<void>;
214214
}
215215

216216
/**

mobile/ios/simulator/ios-simulator-application-manager.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,27 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
3232
}
3333
}
3434

35-
this.iosSim.installApplication(this.identifier, packageFilePath);
35+
await this.iosSim.installApplication(this.identifier, packageFilePath);
3636
}
3737

3838
public async uninstallApplication(appIdentifier: string): Promise<void> {
3939
return this.iosSim.uninstallApplication(this.identifier, appIdentifier);
4040
}
4141

4242
public async startApplication(appData: Mobile.IApplicationData): Promise<void> {
43-
const launchResult = this.iosSim.startApplication(this.identifier, appData.appId);
43+
const launchResult = await this.iosSim.startApplication(this.identifier, appData.appId);
4444
const pid = launchResult.split(":")[1].trim();
4545
this.$deviceLogProvider.setApplicationPidForDevice(this.identifier, pid);
4646
this.$deviceLogProvider.setProjectNameForDevice(this.identifier, appData.projectName);
4747

4848
if (!this.$options.justlaunch) {
49-
this.$iOSSimulatorLogProvider.startLogProcess(this.identifier);
49+
await this.$iOSSimulatorLogProvider.startLogProcess(this.identifier);
5050
}
5151
}
5252

5353
public async stopApplication(appData: Mobile.IApplicationData): Promise<void> {
54-
return this.iosSim.stopApplication(this.identifier, appData.appId, appData.projectName);
54+
const result = await this.iosSim.stopApplication(this.identifier, appData.appId, appData.projectName);
55+
return result;
5556
}
5657

5758
public async getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo> {
@@ -83,7 +84,7 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
8384
return null;
8485
}
8586

86-
const applicationPath = this.iosSim.getApplicationPath(this.identifier, appIdentifier),
87+
const applicationPath = await this.iosSim.getApplicationPath(this.identifier, appIdentifier),
8788
pathToInfoPlist = path.join(applicationPath, "Info.plist");
8889

8990
return this.$fs.exists(pathToInfoPlist) ? await this.$plistParser.parseFile(pathToInfoPlist) : null;

mobile/ios/simulator/ios-simulator-device.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ export class IOSSimulator implements Mobile.IiOSSimulator {
5252
}
5353

5454
public async openDeviceLogStream(): Promise<void> {
55-
this.$iOSSimulatorLogProvider.startLogProcess(this.simulator.id);
55+
await this.$iOSSimulatorLogProvider.startLogProcess(this.simulator.id);
5656
}
5757
}

mobile/ios/simulator/ios-simulator-log-provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export class IOSSimulatorLogProvider implements Mobile.IiOSSimulatorLogProvider
99
private $logger: ILogger,
1010
private $processService: IProcessService) { }
1111

12-
public startLogProcess(deviceIdentifier: string): void {
12+
public async startLogProcess(deviceIdentifier: string): Promise<void> {
1313
if (!this.simulatorsLoggingEnabled[deviceIdentifier]) {
14-
const deviceLogChildProcess: ChildProcess = this.$iOSSimResolver.iOSSim.getDeviceLogProcess(deviceIdentifier, 'senderImagePath contains "NativeScript"');
14+
const deviceLogChildProcess: ChildProcess = await this.$iOSSimResolver.iOSSim.getDeviceLogProcess(deviceIdentifier, 'senderImagePath contains "NativeScript"');
1515

1616
const action = (data: NodeBuffer | string) => {
1717
this.$deviceLogProvider.logData(data.toString(), this.$devicePlatformsConstants.iOS, deviceIdentifier);

0 commit comments

Comments
 (0)