diff --git a/lib/commands/debug.ts b/lib/commands/debug.ts index 54f947de7e..b0322844f6 100644 --- a/lib/commands/debug.ts +++ b/lib/commands/debug.ts @@ -37,6 +37,8 @@ export class DebugPlatformCommand implements ICommand { const selectedDeviceForDebug = await this.getDeviceForDebug(); + await this.$devicesService.detectCurrentlyAttachedDevices({ shouldReturnImmediateResult: false, platform: this.platform }); + await this.$liveSyncCommandHelper.executeLiveSyncOperation([selectedDeviceForDebug], this.$debugLiveSyncService, this.platform); } diff --git a/lib/definitions/livesync.d.ts b/lib/definitions/livesync.d.ts index 11dea74d7e..5e903fabc0 100644 --- a/lib/definitions/livesync.d.ts +++ b/lib/definitions/livesync.d.ts @@ -256,6 +256,13 @@ interface IDevicePathProvider { } interface ILiveSyncCommandHelper { + /** + * Method sets up configuration, before calling livesync and expects that devices are already discovered. + * @param {Mobile.IDevice[]} devices List of discovered devices + * @param {ILiveSyncService} liveSyncService Service expected to do the actual livesyncing + * @param {string} platform The platform for which the livesync will be ran + * @returns {Promise} + */ executeLiveSyncOperation(devices: Mobile.IDevice[], liveSyncService: ILiveSyncService, platform: string): Promise; getPlatformsForOperation(platform: string): string[]; } diff --git a/lib/services/livesync/livesync-command-helper.ts b/lib/services/livesync/livesync-command-helper.ts index c896d6d478..b1854e4e7a 100644 --- a/lib/services/livesync/livesync-command-helper.ts +++ b/lib/services/livesync/livesync-command-helper.ts @@ -20,8 +20,6 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper { this.$errors.failWithoutHelp("Unable to find applicable devices to execute operation and unable to start emulator when platform is not specified."); } - await this.$devicesService.detectCurrentlyAttachedDevices({ shouldReturnImmediateResult: false, platform }); - const workingWithiOSDevices = !platform || this.$mobileHelper.isiOSPlatform(platform); const shouldKeepProcessAlive = this.$options.watch || !this.$options.justlaunch; if (workingWithiOSDevices && shouldKeepProcessAlive) {