Skip to content

Commit cc56ed2

Browse files
Fix ios-device-operations dispose (#2662)
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.
1 parent 81a3a8b commit cc56ed2

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

lib/commands/debug.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ export class DebugIOSCommand extends DebugPlatformCommand {
8383
$platformService: IPlatformService,
8484
$options: IOptions,
8585
$projectData: IProjectData,
86-
$platformsData: IPlatformsData) {
87-
86+
$platformsData: IPlatformsData,
87+
$iosDeviceOperations: IIOSDeviceOperations) {
8888
super($iOSDebugService, $devicesService, $injector, $logger, $devicePlatformsConstants, $config, $usbLiveSyncService, $platformService, $projectData, $options, $platformsData);
89+
$iosDeviceOperations.setShouldDispose(this.$options.justlaunch);
8990
}
9091

9192
public async canExecute(args: string[]): Promise<boolean> {

lib/device-sockets/ios/socket-request-executor.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ export class IOSSocketRequestExecutor implements IiOSSocketRequestExecutor {
44
constructor(private $errors: IErrors,
55
private $iOSNotification: IiOSNotification,
66
private $iOSNotificationService: IiOSNotificationService,
7-
private $logger: ILogger,
8-
private $iosDeviceOperations: IIOSDeviceOperations) {
9-
this.$iosDeviceOperations.setShouldDispose(false);
10-
}
7+
private $logger: ILogger) { }
118

129
public async executeAttachRequest(device: Mobile.IiOSDevice, timeout: number, projectId: string): Promise<void> {
1310
const deviceIdentifier = device.deviceInfo.identifier;

lib/services/ios-log-filter.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
let sourcemap = require("source-map");
22
import * as path from "path";
33
import { cache } from "../common/decorators";
4+
import * as iOSLogFilterBase from "../common/mobile/ios/ios-log-filter";
45

5-
export class IOSLogFilter implements Mobile.IPlatformLogFilter {
6+
export class IOSLogFilter extends iOSLogFilterBase.IOSLogFilter implements Mobile.IPlatformLogFilter {
7+
protected infoFilterRegex = /^.*?(<Notice>:.*?((CONSOLE LOG|JS ERROR).*?)|(<Warning>:.*?)|(<Error>:.*?))$/im;
68

79
private partialLine: string = null;
810

9-
constructor(private $fs: IFileSystem,
10-
private $projectData: IProjectData) { }
11+
constructor($loggingLevels: Mobile.ILoggingLevels,
12+
private $fs: IFileSystem,
13+
private $projectData: IProjectData) {
14+
super($loggingLevels);
15+
}
1116

1217
public filterData(data: string, logLevel: string, pid?: string): string {
18+
data = super.filterData(data, logLevel, pid);
1319
if (pid && data && data.indexOf(`[${pid}]`) === -1) {
1420
return null;
1521
}
1622

17-
let skipLastLine = data[data.length - 1] !== "\n";
18-
1923
if (data) {
24+
let skipLastLine = data[data.length - 1] !== "\n";
2025
let lines = data.split("\n");
2126
let result = "";
2227
for (let i = 0; i < lines.length; i++) {
@@ -45,7 +50,7 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter {
4550
continue;
4651
}
4752
}
48-
if (skipLastLine && i === lines.length - 1) {
53+
if (skipLastLine && i === lines.length - 1 && lines.length > 1) {
4954
this.partialLine = line;
5055
} else {
5156
result += this.getOriginalFileLocation(line) + "\n";

0 commit comments

Comments
 (0)