-
Notifications
You must be signed in to change notification settings - Fork 238
Open
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Description
I'm using the node API as in the following example:
/**
* A custom `vsce package` script, to support patching `package.json` manifest
* @param {string[]} args
* @returns {Promise<number>}
*/
async function main(...args) {
contents = await readFile(packageJsonPath, { encoding: 'utf-8' });
try {
await ensureServerWasmFilesAreCopied();
await ensureServerModuleIsCopied();
await patchPackageJson(contents);
// package extension
await createVSIX({
packagePath: path.join(packagePath, 'out'),
});
} catch (error) {
console.error(error);
return 1;
} finally {
// restore original contents
if (contents) {
await writeFile(packageJsonPath, contents);
}
}
return 0;
}But because it follows the following code path:
- https://github.com/microsoft/vscode-vsce/blob/main/src/api.ts#L65
- https://github.com/microsoft/vscode-vsce/blob/main/src/package.ts#L1989
- https://github.com/microsoft/vscode-vsce/blob/main/src/package.ts#L1914
- https://github.com/microsoft/vscode-vsce/blob/main/src/package.ts#L2059
- https://github.com/microsoft/vscode-vsce/blob/main/src/package.ts#L2086 (
printAndValidatePackagedFiles)
The process will straight up exit, causing my finally block to never be executed. This is odd behaviour and I would suggest a change is made to throw an error to check if running from the cli or the api, and catching it higher up to see if the process should exit or rethrow.
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug