Skip to content

Commit

Permalink
fix: close terminals when closing vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobrosenberg committed Apr 20, 2022
1 parent 39aa347 commit fc23a1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions extension.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
const { PyMakr } = require("./src/PyMakr");

/** @type {PyMakr} */
let pymakr;

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed

/**
* @param {import('vscode').ExtensionContext} context
*/
async function activate(context) {
new PyMakr(context);
pymakr = new PyMakr(context);
}

// this method is called when your extension is deactivated
function deactivate() {
//todo: close any open terminals to avoid them hanging when VScode is restarted at a later stage.
}
function deactivate() {}

module.exports = {
activate,
Expand Down
3 changes: 3 additions & 0 deletions src/terminal/Terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class Terminal {

this.term = vscode.window.createTerminal({ name, shellPath, shellArgs });
this.term.show();

// dispose of the terminal when closing VSCode
this.pyMakr.context.subscriptions.push(this.term)
}
}

Expand Down

0 comments on commit fc23a1c

Please sign in to comment.