aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-16 12:49:20 +0000
committerGitHub <[email protected]>2019-11-16 12:49:20 +0000
commit7ad44610819d0bc69d4a2e0b9a74672ebb0fd585 (patch)
tree29ed8db25cca3c6c46be2e507818add89af34ea0
parentd9d99369b2765eaef7f49cd519990769191c3381 (diff)
parentb4fae56a25a3643198ebe1c3c0d52148cfc49477 (diff)
Merge #2263
2263: Handle `cargo watch` errors caused by `cargo-watch` itself r=matklad a=oxalica Currently, it silently fails when `cargo-watch` is installed but broken. This PR handles missing cases and prompt the error message when failed. Co-authored-by: oxalica <[email protected]>
-rw-r--r--editors/code/src/commands/runnables.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts
index 26372c1e8..ac59bf60d 100644
--- a/editors/code/src/commands/runnables.ts
+++ b/editors/code/src/commands/runnables.ts
@@ -161,7 +161,9 @@ export async function startCargoWatch(
161): Promise<CargoWatchProvider | undefined> { 161): Promise<CargoWatchProvider | undefined> {
162 const execPromise = util.promisify(child_process.exec); 162 const execPromise = util.promisify(child_process.exec);
163 163
164 const { stderr } = await execPromise('cargo watch --version').catch(e => e); 164 const { stderr, code = 0 } = await execPromise(
165 'cargo watch --version'
166 ).catch(e => e);
165 167
166 if (stderr.includes('no such subcommand: `watch`')) { 168 if (stderr.includes('no such subcommand: `watch`')) {
167 const msg = 169 const msg =
@@ -201,6 +203,11 @@ export async function startCargoWatch(
201 ); 203 );
202 return; 204 return;
203 } 205 }
206 } else if (code !== 0) {
207 vscode.window.showErrorMessage(
208 `\`cargo watch\` failed with ${code}: ${stderr}`
209 );
210 return;
204 } 211 }
205 212
206 const provider = await registerCargoWatchProvider(context.subscriptions); 213 const provider = await registerCargoWatchProvider(context.subscriptions);