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

Commit 84ecbd4

Browse files
committed
Use async API from ios-sim
Fixes NativeScript/nativescript-cli#3545
1 parent b707b42 commit 84ecbd4

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
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
@@ -233,7 +233,7 @@ declare module Mobile {
233233
* @param {string} deviceId The unique identifier of the device.
234234
* @param {Mobile.IiOSLogStreamOptions} options Describes the options which can be passed
235235
*/
236-
startLogProcess(deviceId: string, options?: Mobile.IiOSLogStreamOptions): void;
236+
startLogProcess(deviceId: string, options?: Mobile.IiOSLogStreamOptions): Promise<void>;
237237
/**
238238
* Starts a new process for getting simulator logs and emits and DEVICE_LOG_EVENT_NAME event. The event's reponse is with muted=true flag so it will not be printed from deviceLogProvider.
239239
* @param {string} deviceId The unique identifier of the device.

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

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

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

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

4242
public async startApplication(appData: Mobile.IApplicationData): Promise<void> {
43-
const launchResult = this.iosSim.startApplication(this.device.deviceInfo.identifier, appData.appId);
43+
const launchResult = await this.iosSim.startApplication(this.device.deviceInfo.identifier, appData.appId);
4444
const pid = getPidFromiOSSimulatorLogs(appData.appId, launchResult);
4545
await this.setDeviceLogData(appData, pid);
4646
}
@@ -87,7 +87,7 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
8787
return null;
8888
}
8989

90-
const applicationPath = this.iosSim.getApplicationPath(this.device.deviceInfo.identifier, appIdentifier),
90+
const applicationPath = await this.iosSim.getApplicationPath(this.device.deviceInfo.identifier, appIdentifier),
9191
pathToInfoPlist = path.join(applicationPath, "Info.plist");
9292

9393
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
@@ -58,7 +58,7 @@ export class IOSSimulator implements Mobile.IiOSSimulator {
5858
public async openDeviceLogStream(options?: Mobile.IiOSLogStreamOptions): Promise<void> {
5959
this._deviceLogHandler = this.onDeviceLog.bind(this, options);
6060
this.$iOSSimulatorLogProvider.on(constants.DEVICE_LOG_EVENT_NAME, this._deviceLogHandler);
61-
this.$iOSSimulatorLogProvider.startLogProcess(this.simulator.id, options);
61+
return this.$iOSSimulatorLogProvider.startLogProcess(this.simulator.id, options);
6262
}
6363

6464
public detach(): void {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export class IOSSimulatorLogProvider extends EventEmitter implements Mobile.IiOS
1818
this.shouldDispose = shouldDispose;
1919
}
2020

21-
public startLogProcess(deviceId: string, options?: Mobile.IiOSLogStreamOptions): void {
21+
public async startLogProcess(deviceId: string, options?: Mobile.IiOSLogStreamOptions): Promise<void> {
2222
if (!this.simulatorsLoggingEnabled[deviceId]) {
23-
const deviceLogChildProcess: ChildProcess = this.$iOSSimResolver.iOSSim.getDeviceLogProcess(deviceId, options ? options.predicate : null);
23+
const deviceLogChildProcess: ChildProcess = await this.$iOSSimResolver.iOSSim.getDeviceLogProcess(deviceId, options ? options.predicate : null);
2424

2525
const action = (data: NodeBuffer | string) => {
2626
const message = data.toString();

0 commit comments

Comments
 (0)