azdata extension fix/updates (#12008)

This commit is contained in:
Charles Gagnon
2020-08-28 16:49:21 -07:00
committed by GitHub
parent 47c1204e89
commit e9b00062a4
3 changed files with 23 additions and 13 deletions

View File

@@ -1,10 +1,14 @@
# Microsoft azdata Extension for Azure Data Studio
# Microsoft Azure Data CLI Extension for Azure Data Studio
Welcome to Microsoft azdata for Azure Data Studio!
Welcome to Microsoft Azure Data CLI Extension for Azure Data Studio!
**This extension is only applicable to customers in the Azure Arc data services private preview. Other usage is not supported at this time.**
## Overview
This extension adds support for azdata within Azure Data Studio.
This extension adds support for the Azure Data CLI (azdata) within Azure Data Studio.
See https://docs.microsoft.com/cli/azure/?view=azure-cli-latest for more information on the tool.
## Code of Conduct

View File

@@ -1,6 +1,6 @@
{
"azdata.displayName": "azdata",
"azdata.description": "Support for Azure Data CLI. See https://docs.microsoft.com/cli/azure/?view=azure-cli-latest for more information.",
"azdata.config.title": "azdata Configuration",
"azdata.displayName": "Azure Data CLI",
"azdata.description": "Support for Azure Data CLI.",
"azdata.config.title": "Azure Data CLI Configuration",
"azdata.config.debug": "Log debug info to the output channel for all executed azdata commands"
}

View File

@@ -128,11 +128,18 @@ export class AzdataTool implements IAzdataTool {
result: <R>output.result
};
} catch (err) {
// Since the output is JSON we need to do some extra parsing here to get the correct stderr out.
// The actual value we get is something like ERROR: { stderr: '...' } so we also need to trim
// off the start that isn't a valid JSON blob
if (err instanceof ExitCodeError) {
err.stderr = JSON.parse(err.stderr.substring(err.stderr.indexOf('{'))).stderr;
try {
// For azdata internal errors the output is JSON and so we need to do some extra parsing here
// to get the correct stderr out. The actual value we get is something like
// ERROR: { stderr: '...' }
// so we also need to trim off the start that isn't a valid JSON blob
err.stderr = JSON.parse(err.stderr.substring(err.stderr.indexOf('{'))).stderr;
} catch (err) {
// no op - it means this was probably some other generic error (such as command not being found)
}
}
throw err;
}
@@ -285,9 +292,8 @@ async function installAzdataLinux(): Promise<void> {
/**
*/
async function findSpecificAzdata(): Promise<IAzdataTool> {
const promise = ((process.platform === 'win32') ? searchForCmd('azdata.cmd') : searchForCmd('azdata'));
const path = `"${await promise}"`; // throws if azdata is not found
const versionOutput = await executeAzdataCommand(path, ['--version']);
const path = await ((process.platform === 'win32') ? searchForCmd('azdata.cmd') : searchForCmd('azdata'));
const versionOutput = await executeAzdataCommand(`"${path}"`, ['--version']);
return new AzdataTool(path, parseVersion(versionOutput.stdout));
}