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:
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.
I'm using the node API as in the following example:
But because it follows the following code path:
printAndValidatePackagedFiles)The process will straight up exit, causing my
finallyblock 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 theclior theapi, and catching it higher up to see if the process should exit or rethrow.