Skip to content

Commit 8c96ad6

Browse files
committed
Merge pull request #1047 from NativeScript/KristinaKoeva/WaitForDebugger
Pass wait for debugger option. Handle simulator output so that we cou…
2 parents 331e33b + ec1fc60 commit 8c96ad6

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

lib/services/ios-debug-service.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as path from "path";
1010
import Future = require("fibers/future");
1111
import semver = require("semver");
1212
import temp = require("temp");
13+
import byline = require("byline");
1314

1415
module notification {
1516
function formatNotification(bundleId: string, notification: string) {
@@ -118,7 +119,20 @@ class IOSDebugService implements IDebugService {
118119
this.$platformService.buildPlatform(this.platform).wait();
119120
let emulatorPackage = this.$platformService.getLatestApplicationPackageForEmulator(platformData).wait();
120121

121-
this.$iOSEmulatorServices.startEmulator(emulatorPackage.packageName, { args: "--nativescript-debug-brk" }).wait();
122+
let child_process = this.$iOSEmulatorServices.startEmulator(emulatorPackage.packageName, { waitForDebugger: true, captureStdin: true, args: "--nativescript-debug-brk" }).wait();
123+
let lineStream = byline(child_process.stdout);
124+
125+
lineStream.on('data', (line: NodeBuffer) => {
126+
let lineText = line.toString();
127+
if(lineText && _.startsWith(lineText, emulatorPackage.packageName)) {
128+
let pid = _.trimLeft(lineText, emulatorPackage.packageName + ": ");
129+
130+
this.$childProcess.exec(`lldb -p ${pid} -o "process continue"`);
131+
} else {
132+
process.stdout.write(line + "\n");
133+
}
134+
});
135+
122136
this.wireDebuggerClient(() => net.connect(InspectorBackendPort)).wait();
123137
}).future<void>()();
124138
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"gulp": "3.9.0",
4242
"iconv-lite": "0.4.11",
4343
"inquirer": "0.9.0",
44-
"ios-sim-portable": "1.0.9-beta",
44+
"ios-sim-portable": "1.0.10-alpha",
4545
"lockfile": "1.0.1",
4646
"lodash": "3.10.0",
4747
"log4js": "0.6.26",

0 commit comments

Comments
 (0)