aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/utils/processes.ts
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-29 12:57:24 +0000
committerGitHub <[email protected]>2019-12-29 12:57:24 +0000
commitdc48f89581843248660ceb755bb20469ab6ac0c9 (patch)
tree05a7e47d1c68c250025be1ce6492f56c15353749 /editors/code/src/utils/processes.ts
parentcdcb3d3833d3d5b37b2cd4dac91a6e9366f20aea (diff)
parent899dbebd02b41b12d89c9f485e85208b39b81932 (diff)
Merge #2668
2668: In-server cargo check watching r=matklad a=kiljacken Opening a draft now so people can follow the progress, and comment if they spot something stupid. Things that need doing: - [x] Running cargo check on save - [x] Pipe through configuration options from client - [x] Tests for parsing behavior - [x] Remove existing cargo watch support from VSCode extension - [x] Progress notification in VSCode extension using LSP 3.15 `$/progress` notification - [ ] ~~Rework ra-ide diagnostics to support secondary messages~~ - [ ] ~~Make cargo-check watcher use ra-ide diagnostics~~ ~~I'd love some input on whether to try to keep the status bar progress thingy for VSCode? It will require some plumbing, and maintaining yet another rust-analyzer specific LSP notification, which I'm not sure we want to.~~ Fixes #1894 Co-authored-by: Emil Lauridsen <[email protected]>
Diffstat (limited to 'editors/code/src/utils/processes.ts')
-rw-r--r--editors/code/src/utils/processes.ts51
1 files changed, 0 insertions, 51 deletions
diff --git a/editors/code/src/utils/processes.ts b/editors/code/src/utils/processes.ts
deleted file mode 100644
index a1d6b7eaf..000000000
--- a/editors/code/src/utils/processes.ts
+++ /dev/null
@@ -1,51 +0,0 @@
1'use strict';
2
3import * as cp from 'child_process';
4import ChildProcess = cp.ChildProcess;
5
6import { join } from 'path';
7
8const isWindows = process.platform === 'win32';
9const isMacintosh = process.platform === 'darwin';
10const isLinux = process.platform === 'linux';
11
12// this is very complex, but is basically copy-pased from VSCode implementation here:
13// https://github.com/Microsoft/vscode-languageserver-node/blob/dbfd37e35953ad0ee14c4eeced8cfbc41697b47e/client/src/utils/processes.ts#L15
14
15// And see discussion at
16// https://github.com/rust-analyzer/rust-analyzer/pull/1079#issuecomment-478908109
17
18export function terminate(process: ChildProcess, cwd?: string): boolean {
19 if (isWindows) {
20 try {
21 // This we run in Atom execFileSync is available.
22 // Ignore stderr since this is otherwise piped to parent.stderr
23 // which might be already closed.
24 const options: any = {
25 stdio: ['pipe', 'pipe', 'ignore'],
26 };
27 if (cwd) {
28 options.cwd = cwd;
29 }
30 cp.execFileSync(
31 'taskkill',
32 ['/T', '/F', '/PID', process.pid.toString()],
33 options,
34 );
35 return true;
36 } catch (err) {
37 return false;
38 }
39 } else if (isLinux || isMacintosh) {
40 try {
41 const cmd = join(__dirname, 'terminateProcess.sh');
42 const result = cp.spawnSync(cmd, [process.pid.toString()]);
43 return result.error ? false : true;
44 } catch (err) {
45 return false;
46 }
47 } else {
48 process.kill('SIGKILL');
49 return true;
50 }
51}