Skip to content

Fix ios-device-operations dispose #2662

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
Mar 27, 2017
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions lib/commands/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean> {
Expand Down
5 changes: 1 addition & 4 deletions lib/device-sockets/ios/socket-request-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
const deviceIdentifier = device.deviceInfo.identifier;
Expand Down
17 changes: 11 additions & 6 deletions lib/services/ios-log-filter.ts
Original file line number Diff line number Diff line change
@@ -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 = /^.*?(<Notice>:.*?((CONSOLE LOG|JS ERROR).*?)|(<Warning>:.*?)|(<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++) {
Expand Down Expand Up @@ -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";
Expand Down