Skip to content

fix: debug android --start should allow to debug #4774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/commands/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
$projectData: IProjectData,
$options: IOptions,
$platformsDataService: IPlatformsDataService,
$cleanupService: ICleanupService,
protected $logger: ILogger,
protected $errors: IErrors,
private $debugDataService: IDebugDataService,
private $debugController: IDebugController,
private $liveSyncCommandHelper: ILiveSyncCommandHelper,
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper) {
super($options, $platformsDataService, $platformValidationService, $projectData);
$cleanupService.setShouldDispose(false);
}

public async execute(args: string[]): Promise<void> {
Expand Down Expand Up @@ -87,16 +89,14 @@ export class DebugIOSCommand implements ICommand {
private $sysInfo: ISysInfo,
private $projectData: IProjectData,
$iosDeviceOperations: IIOSDeviceOperations,
$iOSSimulatorLogProvider: Mobile.IiOSSimulatorLogProvider,
$cleanupService: ICleanupService) {
$iOSSimulatorLogProvider: Mobile.IiOSSimulatorLogProvider) {
this.$projectData.initializeProjectData();
// Do not dispose ios-device-lib, so the process will remain alive and the debug application (NativeScript Inspector or Chrome DevTools) will be able to connect to the socket.
// In case we dispose ios-device-lib, the socket will be closed and the code will fail when the debug application tries to read/send data to device socket.
// That's why the `$ tns debug ios --justlaunch` command will not release the terminal.
// In case we do not set it to false, the dispose will be called once the command finishes its execution, which will prevent the debugging.
$iosDeviceOperations.setShouldDispose(false);
$iOSSimulatorLogProvider.setShouldDispose(false);
$cleanupService.setShouldDispose(false);
}

public execute(args: string[]): Promise<void> {
Expand Down