Skip to content

Commit 3571b9d

Browse files
committed
Fix #191: Stop running code when VS Code is closed
1 parent 8cce294 commit 3571b9d

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 0.7.4 (2017-10-20)
2+
* [#191](https://github.com/formulahendry/vscode-code-runner/issues/191): Stop running code when VS Code is closed
3+
14
### 0.7.3 (2017-10-14)
25
* Add support for Multi Root Workspaces
36

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "code-runner",
33
"displayName": "Code Runner",
44
"description": "Run C, C++, Java, JS, PHP, Python, Perl, Ruby, Go, Lua, Groovy, PowerShell, CMD, BASH, F#, C#, VBScript, TypeScript, CoffeeScript, Scala, Swift, Julia, Crystal, OCaml, R, AppleScript, Elixir, VB.NET, Clojure, Haxe, Objective-C, Rust, Racket, AutoHotkey, AutoIt, Kotlin, Dart, Pascal, Haskell, Nim, D",
5-
"version": "0.7.3",
5+
"version": "0.7.4",
66
"publisher": "formulahendry",
77
"icon": "images/logo.png",
88
"engines": {

src/codeManager.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { AppInsightsClient } from "./appInsightsClient";
77

88
const TmpDir = os.tmpdir();
99

10-
export class CodeManager {
10+
export class CodeManager implements vscode.Disposable {
1111
private _outputChannel: vscode.OutputChannel;
1212
private _terminal: vscode.Terminal;
1313
private _isRunning: boolean;
@@ -87,6 +87,14 @@ export class CodeManager {
8787

8888
public stop(): void {
8989
this._appInsightsClient.sendEvent("stop");
90+
this.stopRunning();
91+
}
92+
93+
public dispose() {
94+
this.stopRunning();
95+
}
96+
97+
private stopRunning() {
9098
if (this._isRunning) {
9199
this._isRunning = false;
92100
const kill = require("tree-kill");

src/extension.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function activate(context: vscode.ExtensionContext) {
3030
context.subscriptions.push(runCustomCommand);
3131
context.subscriptions.push(runByLanguage);
3232
context.subscriptions.push(stop);
33+
context.subscriptions.push(codeManager);
3334
}
3435

3536
export function deactivate() {

0 commit comments

Comments
 (0)