aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-04-01 18:11:22 +0100
committerEdwin Cheng <[email protected]>2019-04-02 08:03:31 +0100
commitb84d0fc1a307f6103ea2c2620a106db821696434 (patch)
tree99d158e992a58a07cbf51676add9784583b401c8 /editors/code/src/commands
parentc894a3e19b0e658622a03a7d0539a78a433b42ae (diff)
Add proper process teminate method
Diffstat (limited to 'editors/code/src/commands')
-rw-r--r--editors/code/src/commands/cargo_watch.ts17
-rw-r--r--editors/code/src/commands/watch_status.ts1
2 files changed, 10 insertions, 8 deletions
diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts
index 037f1e302..e51cac78a 100644
--- a/editors/code/src/commands/cargo_watch.ts
+++ b/editors/code/src/commands/cargo_watch.ts
@@ -1,9 +1,10 @@
1import * as child_process from 'child_process'; 1import * as child_process from 'child_process';
2import * as path from 'path'; 2import * as path from 'path';
3import * as timers from 'timers';
4import * as vscode from 'vscode'; 3import * as vscode from 'vscode';
4import { terminate } from '../utils/processes';
5import { StatusDisplay } from './watch_status'; 5import { StatusDisplay } from './watch_status';
6 6
7
7export class CargoWatchProvider { 8export class CargoWatchProvider {
8 private diagnosticCollection?: vscode.DiagnosticCollection; 9 private diagnosticCollection?: vscode.DiagnosticCollection;
9 private cargoProcess?: child_process.ChildProcess; 10 private cargoProcess?: child_process.ChildProcess;
@@ -21,24 +22,25 @@ export class CargoWatchProvider {
21 // Start the cargo watch with json message 22 // Start the cargo watch with json message
22 this.cargoProcess = child_process.spawn( 23 this.cargoProcess = child_process.spawn(
23 'cargo', 24 'cargo',
24 ['watch', '-x', '"check --message-format json"'], 25 ['watch', '-x', '\"check --message-format json\"'],
25 { 26 {
26 // stdio: ['ignore', 'pipe', 'ignore'], 27 stdio: ['ignore', 'pipe', 'pipe'],
27 shell: true, 28 cwd: vscode.workspace.rootPath,
28 cwd: vscode.workspace.rootPath 29 windowsVerbatimArguments: true,
29 } 30 }
30 ); 31 );
31 32
32 this.cargoProcess.stdout.on('data', (s: string) => { 33 this.cargoProcess.stdout.on('data', (s: string) => {
33 this.processOutput(s); 34 this.processOutput(s);
35 console.log(s);
34 }); 36 });
35 37
36 this.cargoProcess.stderr.on('data', (s: string) => { 38 this.cargoProcess.stderr.on('data', (s: string) => {
37 // console.error('Error on cargo watch : ' + s); 39 console.error('Error on cargo watch : ' + s);
38 }); 40 });
39 41
40 this.cargoProcess.on('error', (err: Error) => { 42 this.cargoProcess.on('error', (err: Error) => {
41 // console.error('Error on spawn cargo process : ' + err); 43 console.error('Error on spawn cargo process : ' + err);
42 }); 44 });
43 } 45 }
44 46
@@ -50,6 +52,7 @@ export class CargoWatchProvider {
50 52
51 if (this.cargoProcess) { 53 if (this.cargoProcess) {
52 this.cargoProcess.kill(); 54 this.cargoProcess.kill();
55 terminate(this.cargoProcess);
53 } 56 }
54 } 57 }
55 58
diff --git a/editors/code/src/commands/watch_status.ts b/editors/code/src/commands/watch_status.ts
index 1b0611ce3..f027d7bbc 100644
--- a/editors/code/src/commands/watch_status.ts
+++ b/editors/code/src/commands/watch_status.ts
@@ -1,4 +1,3 @@
1import * as timers from 'timers';
2import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
3 2
4const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; 3const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];