Skip to content

Commit 6c36359

Browse files
committed
fix: ensure running app only on LiveSync as its causing issues in debug
When we try to get debug socket in (tns debug ios --debug-brk), the additional app start is resuming the app and we are not able to debug the app start.
1 parent 215f454 commit 6c36359

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

lib/common/definitions/mobile.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ declare module Mobile {
106106
}
107107

108108
interface IiOSDevice extends IDevice {
109-
getDebugSocket(appId: string, projectName: string): Promise<any>;
109+
getDebugSocket(appId: string, projectName: string, ensureAppStarted?: boolean): Promise<any>;
110110
destroyDebugSocket(appId: string): Promise<void>;
111111
openDeviceLogStream(options?: IiOSLogStreamOptions): Promise<void>;
112112
destroyAllSockets(): Promise<void>;

lib/common/mobile/ios/ios-device-base.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ export abstract class IOSDeviceBase implements Mobile.IiOSDevice {
1515
abstract openDeviceLogStream(options?: Mobile.IiOSLogStreamOptions): Promise<void>;
1616

1717
@performanceLog()
18-
public async getDebugSocket(appId: string, projectName: string): Promise<net.Socket> {
18+
public async getDebugSocket(appId: string, projectName: string, ensureAppStarted: boolean = false): Promise<net.Socket> {
1919
return this.$lockService.executeActionWithLock(
2020
async () => {
2121
if (this.cachedSockets[appId]) {
2222
return this.cachedSockets[appId];
2323
}
2424

2525
await this.attachToDebuggerFoundEvent(appId, projectName);
26-
await this.applicationManager.startApplication({ appId, projectName });
26+
if (ensureAppStarted) {
27+
await this.applicationManager.startApplication({ appId, projectName });
28+
}
29+
2730
this.cachedSockets[appId] = await this.getDebugSocketCore(appId);
2831

2932
if (this.cachedSockets[appId]) {

lib/services/livesync/ios-device-livesync-service.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ export class IOSDeviceLiveSyncService extends DeviceLiveSyncServiceBase implemen
2525

2626
const appId = projectData.projectIdentifiers.ios;
2727
try {
28-
this.socket = await this.device.getDebugSocket(appId, projectData.projectName);
28+
// TODO: temp workaround till we setup the sockets along with the app start
29+
const ensureAppStarted = true;
30+
this.socket = await this.device.getDebugSocket(appId, projectData.projectName, ensureAppStarted);
2931
} catch (err) {
3032
this.$logger.trace(`Error while connecting to the debug socket. Error is:`, err);
3133
}

0 commit comments

Comments
 (0)