Skip to content

Commit

Permalink
Stop debugging on program end - Fix microsoft#11
Browse files Browse the repository at this point in the history
  • Loading branch information
rianadon committed Jun 19, 2017
1 parent 9724496 commit 8f2d82a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/nodeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ export class NodeDebugAdapter extends ChromeDebugAdapter {
super.commonArgs(args);
}

protected hookConnectionEvents(): void {
super.hookConnectionEvents();

this.chrome.Runtime.onExecutionContextDestroyed(params => {
if (params.executionContextId === 1) {
this.terminateSession('Program ended');
}
});
}

protected async doAttach(port: number, targetUrl?: string, address?: string, timeout?: number): Promise<any> {
await super.doAttach(port, targetUrl, address, timeout);
this.beginWaitingForDebuggerPaused();
Expand Down
3 changes: 1 addition & 2 deletions test/adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ suite('Node Debug Adapter etc', () => {
});

suite('launch', () => {
// #11
test.skip('should run program to the end', () => {
test('should run program to the end', () => {
const PROGRAM = path.join(DATA_ROOT, 'program.js');

return Promise.all([
Expand Down

0 comments on commit 8f2d82a

Please sign in to comment.