Skip to content

Commit 1519b2e

Browse files
author
Dimitar Tachev
authored
Merge pull request #4465 from NativeScript/tachev/fix-debug-brk
fix: debugging clients are now able to debug with debug-brk
2 parents 1f1cce0 + 6c36359 commit 1519b2e

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

lib/commands/debug.ts

-4
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
6666
this.$errors.fail("--release flag is not applicable to this command");
6767
}
6868

69-
if (this.$options.hmr && this.$options.debugBrk) {
70-
this.$errors.fail("--debug-brk and --hmr flags cannot be combined");
71-
}
72-
7369
const minSupportedWebpackVersion = this.$options.hmr ? LiveSyncCommandHelper.MIN_SUPPORTED_WEBPACK_VERSION_WITH_HMR : null;
7470
this.$bundleValidatorHelper.validate(minSupportedWebpackVersion);
7571

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)