Skip to content

Fixed: Ctrl+C not working on Android debug+watch #2121

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 12, 2016
Merged
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
14 changes: 13 additions & 1 deletion lib/services/android-debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import * as path from "path";
import * as net from "net";
import Future = require("fibers/future");
import { sleep } from "../common/helpers";
import {ChildProcess} from "child_process";

class AndroidDebugService implements IDebugService {
private static DEFAULT_NODE_INSPECTOR_URL = "http://127.0.0.1:8080/debug";

private _device: Mobile.IAndroidDevice = null;
private _debuggerClientProcess: ChildProcess;

constructor(private $devicesService: Mobile.IDevicesService,
private $platformService: IPlatformService,
Expand All @@ -19,6 +21,7 @@ class AndroidDebugService implements IDebugService {
private $errors: IErrors,
private $opener: IOpener,
private $config: IConfiguration,
private $processService: IProcessService,
private $androidDeviceDiscovery: Mobile.IDeviceDiscovery) { }

public get platform() { return "android"; }
Expand Down Expand Up @@ -187,6 +190,7 @@ class AndroidDebugService implements IDebugService {
}

public debugStop(): IFuture<void> {
this.stopDebuggerClient();
return Future.fromResult();
}

Expand Down Expand Up @@ -237,10 +241,18 @@ class AndroidDebugService implements IDebugService {
let nodeInspectorModuleFilePath = require.resolve("node-inspector");
let nodeInspectorModuleDir = path.dirname(nodeInspectorModuleFilePath);
let nodeInspectorFullPath = path.join(nodeInspectorModuleDir, "bin", "inspector");
this.$childProcess.spawn(process.argv[0], [nodeInspectorFullPath, "--debug-port", port.toString()], { stdio: "ignore", detached: true });
this._debuggerClientProcess = this.$childProcess.spawn(process.argv[0], [nodeInspectorFullPath, "--debug-port", port.toString()], { stdio: "ignore", detached: true });
this.$processService.attachToProcessExitSignals(this, this.debugStop);
}).future<void>()();
}

private stopDebuggerClient(): void {
if (this._debuggerClientProcess) {
this._debuggerClientProcess.kill();
this._debuggerClientProcess = null;
}
}

private openDebuggerClient(url: string): void {
let defaultDebugUI = "chrome";
if (this.$hostInfo.isDarwin) {
Expand Down