Skip to content

Commit 96a38ed

Browse files
committed
Fix tests
Kill process before debug session.
1 parent 55091b2 commit 96a38ed

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

src/debug-adapter/nativeScriptDebugLauncher.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class NativeScriptDebugLauncher extends EventEmitter {
1919
public async processRequest(args: any) : Promise<any> {
2020
args = this.translateArgs(args);
2121
Services.appRoot = args.appRoot;
22+
Services.extensionClient().cleanBeforeDebug();
2223
const settings = await Services.extensionClient().getInitSettings();
2324

2425
Services.cliPath = settings.tnsPath || Services.cliPath;

src/ipc/extensionClient.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ export class ExtensionClient {
5555
return <Promise<extProtocol.InitSettingsResult>>(this.callRemoteMethod('getInitSettings'));
5656
}
5757

58+
public cleanBeforeDebug(): Promise<any> {
59+
return this.callRemoteMethod('cleanBeforeDebug');
60+
}
61+
5862
public analyticsLaunchDebugger(args: extProtocol.AnalyticsLaunchDebuggerArgs): Promise<any> {
5963
return this.callRemoteMethod('analyticsLaunchDebugger', args);
6064
}

src/ipc/extensionServer.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import {QuickPickItem} from 'vscode';
55
import * as extProtocol from './extensionProtocol';
66
import {Services} from '../services/extensionHostServices';
77
import {getSocketId} from "./sockedId";
8+
import {Disposable} from "vscode";
89

910
let ipc = require('node-ipc');
1011

1112
export class ExtensionServer {
1213
private _isRunning: boolean;
14+
private disposablesBeforeDebug: Disposable[] = new Array<Disposable>();
1315

1416
constructor() {
1517
this._isRunning = false;
@@ -40,6 +42,14 @@ export class ExtensionServer {
4042
}
4143
}
4244

45+
public registerForCleanBeforeDebug(...disposables: Disposable[]) {
46+
this.disposablesBeforeDebug.push(...disposables)
47+
}
48+
49+
public cleanBeforeDebug() {
50+
this.disposablesBeforeDebug.forEach(disposable => disposable.dispose());
51+
}
52+
4353
public isRunning() {
4454
return this._isRunning;
4555
}

src/main.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,13 @@ export function activate(context: vscode.ExtensionContext) {
5555
runChannel.hide();
5656
});
5757

58-
context.subscriptions.push({
58+
const disposable = {
5959
dispose: () => utils.killProcess(tnsProcess)
60-
});
60+
};
61+
62+
context.subscriptions.push(disposable);
63+
64+
Services.extensionServer().registerForCleanBeforeDebug(disposable);
6165
};
6266

6367
let runIosCommand = vscode.commands.registerCommand('nativescript.runIos', () => {

0 commit comments

Comments
 (0)