Check exit code of cargo watch

This commit is contained in:
oxalica 2019-11-16 03:44:38 +08:00
parent 503920532d
commit 4c175fbe8a
No known key found for this signature in database
GPG Key ID: CED392DE0C483D00

View File

@ -161,7 +161,7 @@ export async function startCargoWatch(
): Promise<CargoWatchProvider | undefined> {
const execPromise = util.promisify(child_process.exec);
const { stderr } = await execPromise('cargo watch --version').catch(e => e);
const { stderr, code = 0 } = await execPromise('cargo watch --version').catch(e => e);
if (stderr.includes('no such subcommand: `watch`')) {
const msg =
@ -201,9 +201,9 @@ export async function startCargoWatch(
);
return;
}
} else if (stderr !== '') {
} else if (code !== 0) {
vscode.window.showErrorMessage(
`Couldn't run \`cargo watch\`: ${stderr}`
`\`cargo watch\` failed with ${code}: ${stderr}`
);
return;
}