mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
azdata improvements (#11516)
* azdata improvements * Don't error on sudo command stderr either * Improve output channel logging for commands * Fix childprocess stuff * pr comments * Fix compile errors * more pr comments
This commit is contained in:
@@ -10,9 +10,7 @@ import { ExitCodeError } from './common/childProcess';
|
||||
|
||||
export async function activate(): Promise<void> {
|
||||
const outputChannel = vscode.window.createOutputChannel('azdata');
|
||||
if (false) {
|
||||
await checkForAzdata(outputChannel);
|
||||
}
|
||||
await checkForAzdata(outputChannel);
|
||||
}
|
||||
|
||||
async function checkForAzdata(outputChannel: vscode.OutputChannel): Promise<void> {
|
||||
@@ -20,16 +18,22 @@ async function checkForAzdata(outputChannel: vscode.OutputChannel): Promise<void
|
||||
const azdata = await findAzdata(outputChannel);
|
||||
vscode.window.showInformationMessage(loc.foundExistingAzdata(azdata.path, azdata.version));
|
||||
} catch (err) {
|
||||
const response = await vscode.window.showErrorMessage(loc.couldNotFindAzdataWithPrompt, loc.install, loc.cancel);
|
||||
if (response === loc.install) {
|
||||
try {
|
||||
await downloadAndInstallAzdata(outputChannel);
|
||||
vscode.window.showInformationMessage(loc.azdataInstalled);
|
||||
} catch (err) {
|
||||
// Windows: 1602 is User Cancelling installation - not unexpected so don't display
|
||||
if (!(err instanceof ExitCodeError) || err.code !== 1602) {
|
||||
vscode.window.showWarningMessage(loc.installError(err));
|
||||
}
|
||||
// Don't block on this since we want the extension to finish activating without needing user input.
|
||||
// Calls will be made to handle azdata not being installed
|
||||
promptToInstallAzdata(outputChannel).catch(e => console.log(`Unexpected error prompting to install azdata ${e}`));
|
||||
}
|
||||
}
|
||||
|
||||
async function promptToInstallAzdata(outputChannel: vscode.OutputChannel): Promise<void> {
|
||||
const response = await vscode.window.showErrorMessage(loc.couldNotFindAzdataWithPrompt, loc.install, loc.cancel);
|
||||
if (response === loc.install) {
|
||||
try {
|
||||
await downloadAndInstallAzdata(outputChannel);
|
||||
vscode.window.showInformationMessage(loc.azdataInstalled);
|
||||
} catch (err) {
|
||||
// Windows: 1602 is User Cancelling installation - not unexpected so don't display
|
||||
if (!(err instanceof ExitCodeError) || err.code !== 1602) {
|
||||
vscode.window.showWarningMessage(loc.installError(err));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user