Skip to content

fix: tns debug ios command fails in some cases #3986

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
Oct 8, 2018
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
4 changes: 1 addition & 3 deletions lib/common/commands/device/device-log-stream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { IOS_LOG_PREDICATE } from "../../constants";

export class OpenDeviceLogStreamCommand implements ICommand {
private static NOT_SPECIFIED_DEVICE_ERROR_MESSAGE = "More than one device found. Specify device explicitly.";

Expand All @@ -25,7 +23,7 @@ export class OpenDeviceLogStreamCommand implements ICommand {
this.$errors.fail(OpenDeviceLogStreamCommand.NOT_SPECIFIED_DEVICE_ERROR_MESSAGE);
}

const action = (device: Mobile.IiOSDevice) => device.openDeviceLogStream({predicate: IOS_LOG_PREDICATE});
const action = (device: Mobile.IiOSDevice) => device.openDeviceLogStream();
await this.$devicesService.execute(action);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/common/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ export async function connectEventuallyUntilTimeout(factory: () => Promise<net.S
const connectionTimer = setTimeout(function () {
if (!isResolved) {
isResolved = true;
reject(lastKnownError);
reject(lastKnownError || new Error(`Unable to connect for ${timeout}ms`));
}
}, timeout);

Expand Down
2 changes: 2 additions & 0 deletions lib/common/mobile/ios/simulator/ios-simulator-device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export class IOSSimulator implements Mobile.IiOSSimulator {

@cache()
public async openDeviceLogStream(options?: Mobile.IiOSLogStreamOptions): Promise<void> {
options = options || {};
options.predicate = options.hasOwnProperty("predicate") ? options.predicate : constants.IOS_LOG_PREDICATE;
return this.$iOSSimulatorLogProvider.startLogProcess(this.simulator.id, options);
}
}
5 changes: 3 additions & 2 deletions lib/services/ios-debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as path from "path";
import * as log4js from "log4js";
import { ChildProcess } from "child_process";
import { DebugServiceBase } from "./debug-service-base";
import { IOS_LOG_PREDICATE } from "../common/constants";
import { CONNECTION_ERROR_EVENT_NAME, AWAIT_NOTIFICATION_TIMEOUT_SECONDS } from "../constants";
import { getPidFromiOSSimulatorLogs } from "../common/helpers";
const inspectorAppName = "NativeScript Inspector.app";
Expand All @@ -15,7 +16,7 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
private _sockets: net.Socket[] = [];
private _socketProxy: any;

constructor(protected device: Mobile.IDevice,
constructor(protected device: Mobile.IiOSDevice,
protected $devicesService: Mobile.IDevicesService,
private $platformService: IPlatformService,
private $iOSEmulatorServices: Mobile.IiOSSimulatorService,
Expand Down Expand Up @@ -60,7 +61,7 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
this.$deviceLogProvider.setProjectNameForDevice(debugData.deviceIdentifier, projectName);
}

await this.device.openDeviceLogStream();
await this.device.openDeviceLogStream({ predicate: IOS_LOG_PREDICATE });
}

await this.$iOSDebuggerPortService.attachToDebuggerPortFoundEvent(this.device, debugData, debugOptions);
Expand Down
8 changes: 4 additions & 4 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"inquirer": "6.2.0",
"ios-device-lib": "0.4.15",
"ios-mobileprovision-finder": "1.0.10",
"ios-sim-portable": "4.0.3",
"ios-sim-portable": "4.0.4",
"istextorbinary": "2.2.1",
"jimp": "0.2.28",
"lockfile": "1.0.3",
Expand Down