From 8af206d7abbddc688495bdcf66dc96311823fa87 Mon Sep 17 00:00:00 2001 From: TsvetanMilanov Date: Mon, 27 Mar 2017 15:27:52 +0300 Subject: [PATCH] Fix ios-device-operations dispose We need to check if the justlaunch flag is passed before we set the should dispose property to false. If we set it to false unconditionally when we pass justlaunch flag the process will never exit. --- lib/commands/debug.ts | 5 +++-- lib/common | 2 +- .../ios/socket-request-executor.ts | 5 +---- lib/services/ios-log-filter.ts | 17 +++++++++++------ 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/commands/debug.ts b/lib/commands/debug.ts index a51b3af5ab..0043fc15af 100644 --- a/lib/commands/debug.ts +++ b/lib/commands/debug.ts @@ -83,9 +83,10 @@ export class DebugIOSCommand extends DebugPlatformCommand { $platformService: IPlatformService, $options: IOptions, $projectData: IProjectData, - $platformsData: IPlatformsData) { - + $platformsData: IPlatformsData, + $iosDeviceOperations: IIOSDeviceOperations) { super($iOSDebugService, $devicesService, $injector, $logger, $devicePlatformsConstants, $config, $usbLiveSyncService, $platformService, $projectData, $options, $platformsData); + $iosDeviceOperations.setShouldDispose(this.$options.justlaunch); } public async canExecute(args: string[]): Promise { diff --git a/lib/common b/lib/common index b0aad503a3..c6c878c558 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit b0aad503a33098007db3308c9d7043da618190e0 +Subproject commit c6c878c558a92767fcea51466a4a19e2393dcf52 diff --git a/lib/device-sockets/ios/socket-request-executor.ts b/lib/device-sockets/ios/socket-request-executor.ts index b21e55567b..c52728b2fa 100644 --- a/lib/device-sockets/ios/socket-request-executor.ts +++ b/lib/device-sockets/ios/socket-request-executor.ts @@ -4,10 +4,7 @@ export class IOSSocketRequestExecutor implements IiOSSocketRequestExecutor { constructor(private $errors: IErrors, private $iOSNotification: IiOSNotification, private $iOSNotificationService: IiOSNotificationService, - private $logger: ILogger, - private $iosDeviceOperations: IIOSDeviceOperations) { - this.$iosDeviceOperations.setShouldDispose(false); - } + private $logger: ILogger) { } public async executeAttachRequest(device: Mobile.IiOSDevice, timeout: number, projectId: string): Promise { const deviceIdentifier = device.deviceInfo.identifier; diff --git a/lib/services/ios-log-filter.ts b/lib/services/ios-log-filter.ts index 94fb7db600..8f105a33ca 100644 --- a/lib/services/ios-log-filter.ts +++ b/lib/services/ios-log-filter.ts @@ -1,22 +1,27 @@ let sourcemap = require("source-map"); import * as path from "path"; import { cache } from "../common/decorators"; +import * as iOSLogFilterBase from "../common/mobile/ios/ios-log-filter"; -export class IOSLogFilter implements Mobile.IPlatformLogFilter { +export class IOSLogFilter extends iOSLogFilterBase.IOSLogFilter implements Mobile.IPlatformLogFilter { + protected infoFilterRegex = /^.*?(:.*?((CONSOLE LOG|JS ERROR).*?)|(:.*?)|(:.*?))$/im; private partialLine: string = null; - constructor(private $fs: IFileSystem, - private $projectData: IProjectData) { } + constructor($loggingLevels: Mobile.ILoggingLevels, + private $fs: IFileSystem, + private $projectData: IProjectData) { + super($loggingLevels); + } public filterData(data: string, logLevel: string, pid?: string): string { + data = super.filterData(data, logLevel, pid); if (pid && data && data.indexOf(`[${pid}]`) === -1) { return null; } - let skipLastLine = data[data.length - 1] !== "\n"; - if (data) { + let skipLastLine = data[data.length - 1] !== "\n"; let lines = data.split("\n"); let result = ""; for (let i = 0; i < lines.length; i++) { @@ -45,7 +50,7 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter { continue; } } - if (skipLastLine && i === lines.length - 1) { + if (skipLastLine && i === lines.length - 1 && lines.length > 1) { this.partialLine = line; } else { result += this.getOriginalFileLocation(line) + "\n";