diff options
Diffstat (limited to 'editors/code/src/commands/cargo_watch.ts')
-rw-r--r-- | editors/code/src/commands/cargo_watch.ts | 17 |
1 files changed, 10 insertions, 7 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 @@ | |||
1 | import * as child_process from 'child_process'; | 1 | import * as child_process from 'child_process'; |
2 | import * as path from 'path'; | 2 | import * as path from 'path'; |
3 | import * as timers from 'timers'; | ||
4 | import * as vscode from 'vscode'; | 3 | import * as vscode from 'vscode'; |
4 | import { terminate } from '../utils/processes'; | ||
5 | import { StatusDisplay } from './watch_status'; | 5 | import { StatusDisplay } from './watch_status'; |
6 | 6 | ||
7 | |||
7 | export class CargoWatchProvider { | 8 | export 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 | ||