Skip to content

Commit 65105b2

Browse files
show output when post-install script fails
1 parent d4fc2ae commit 65105b2

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/toolchain/swiftly.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -856,14 +856,18 @@ export class Swiftly {
856856
`Swift ${version} post-install script executed successfully. Additional system packages have been installed.`
857857
);
858858
} catch (error) {
859-
const errorMsg = `Failed to execute post-install script: ${error}`;
860-
logger?.error(errorMsg);
861-
outputChannel.appendLine("");
862-
outputChannel.appendLine(`Error: ${errorMsg}`);
863-
864-
void vscode.window.showErrorMessage(
865-
`Failed to execute post-install script for Swift ${version}. Check the output channel for details.`
866-
);
859+
logger?.error(Error("Failed to execute post-install script", { cause: error }));
860+
void vscode.window
861+
.showErrorMessage(
862+
`Failed to execute post-install script for Swift ${version}. See command output for more details.`,
863+
"Show Command Output"
864+
)
865+
.then(selected => {
866+
if (!selected) {
867+
return;
868+
}
869+
outputChannel.show();
870+
});
867871
}
868872
}
869873

test/unit-tests/toolchain/swiftly.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,7 @@ apt-get -y install build-essential`;
11311131

11321132
// @ts-expect-error mocking vscode window methods makes type checking difficult
11331133
mockVscodeWindow.showWarningMessage.resolves("Execute Script");
1134+
mockVscodeWindow.showErrorMessage.resolves(undefined);
11341135

11351136
await Swiftly.installToolchain("6.0.0", "/path/to/extension");
11361137

0 commit comments

Comments
 (0)