aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editors/code/src/commands/runnables.ts16
1 files changed, 7 insertions, 9 deletions
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts
index 74407dc3e..ea2883ad4 100644
--- a/editors/code/src/commands/runnables.ts
+++ b/editors/code/src/commands/runnables.ts
@@ -1,4 +1,4 @@
1import { exec } from 'child_process'; 1import * as child_process from 'child_process';
2import * as util from 'util'; 2import * as util from 'util';
3import * as vscode from 'vscode'; 3import * as vscode from 'vscode';
4import * as lc from 'vscode-languageclient'; 4import * as lc from 'vscode-languageclient';
@@ -157,7 +157,7 @@ export async function interactivelyStartCargoWatch() {
157 return; 157 return;
158 } 158 }
159 159
160 const execAsync = util.promisify(exec); 160 const execPromise = util.promisify(child_process.exec);
161 161
162 const watch = await vscode.window.showInformationMessage( 162 const watch = await vscode.window.showInformationMessage(
163 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)', 163 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)',
@@ -168,7 +168,7 @@ export async function interactivelyStartCargoWatch() {
168 return; 168 return;
169 } 169 }
170 170
171 const { stderr } = await execAsync('cargo watch --version').catch(e => e); 171 const { stderr } = await execPromise('cargo watch --version').catch(e => e);
172 if (stderr.includes('no such subcommand: `watch`')) { 172 if (stderr.includes('no such subcommand: `watch`')) {
173 const msg = 173 const msg =
174 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)'; 174 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)';
@@ -183,7 +183,7 @@ export async function interactivelyStartCargoWatch() {
183 183
184 const label = 'install-cargo-watch'; 184 const label = 'install-cargo-watch';
185 const taskFinished = new Promise((resolve, reject) => { 185 const taskFinished = new Promise((resolve, reject) => {
186 let disposable = vscode.tasks.onDidEndTask(({ execution }) => { 186 const disposable = vscode.tasks.onDidEndTask(({ execution }) => {
187 if (execution.task.name === label) { 187 if (execution.task.name === label) {
188 disposable.dispose(); 188 disposable.dispose();
189 resolve(); 189 resolve();
@@ -200,12 +200,10 @@ export async function interactivelyStartCargoWatch() {
200 }) 200 })
201 ); 201 );
202 await taskFinished; 202 await taskFinished;
203 const { stderr } = await execAsync('cargo watch --version').catch( 203 const output = await execPromise('cargo watch --version').catch(e => e);
204 e => e 204 if (output.stderr !== '') {
205 );
206 if (stderr !== '') {
207 vscode.window.showErrorMessage( 205 vscode.window.showErrorMessage(
208 `Couldn't install \`cargo-\`watch: ${stderr}` 206 `Couldn't install \`cargo-\`watch: ${output.stderr}`
209 ); 207 );
210 return; 208 return;
211 } 209 }