mirror of
https://github.com/koush/scrypted.git
synced 2026-07-01 13:20:36 +01:00
postrelease
This commit is contained in:
4
server/package-lock.json
generated
4
server/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/server",
|
||||
"version": "0.113.0",
|
||||
"version": "0.114.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/server",
|
||||
"version": "0.113.0",
|
||||
"version": "0.114.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/server",
|
||||
"version": "0.114.0",
|
||||
"version": "0.115.0",
|
||||
"description": "",
|
||||
"dependencies": {
|
||||
"@mapbox/node-pre-gyp": "^1.0.11",
|
||||
|
||||
@@ -15,6 +15,7 @@ function prep(pluginVolume: string, hash: string) {
|
||||
const zipFile = path.join(zipDir, zipFilename);
|
||||
const unzippedPath = path.join(zipDir, 'unzipped')
|
||||
const zipDirTmp = zipDir + '.tmp';
|
||||
const zipDirTmp2 = zipDir + '.tmp2';
|
||||
|
||||
return {
|
||||
unzippedPath,
|
||||
@@ -22,6 +23,7 @@ function prep(pluginVolume: string, hash: string) {
|
||||
zipDir,
|
||||
zipFile,
|
||||
zipDirTmp,
|
||||
zipDirTmp2,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -52,16 +54,39 @@ export function prepareZipSync(pluginVolume: string, h: string, getZip: () => Bu
|
||||
}
|
||||
|
||||
export function extractZip(pluginVolume: string, h: string, zipBuffer: Buffer) {
|
||||
const { zipDir, zipDirTmp, zipFilename, zipFile, unzippedPath } = prep(pluginVolume, h);
|
||||
const { zipDir, zipDirTmp, zipDirTmp2, zipFilename, zipFile, unzippedPath } = prep(pluginVolume, h);
|
||||
|
||||
// stage the plugin zip in a tmp directory, then move it to the final location.
|
||||
// so if the zip extraction is corrupt, it won't be used.
|
||||
fs.rmSync(zipDirTmp, {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
fs.rmSync(zipDir, {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
|
||||
let zipDirTmp2Exists = false;
|
||||
try {
|
||||
fs.rmSync(zipDirTmp2, {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
zipDirTmp2Exists = true;
|
||||
}
|
||||
|
||||
try {
|
||||
fs.rmSync(zipDir, {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
if (zipDirTmp2Exists)
|
||||
throw e;
|
||||
// file lock from dangling plugin process may have prevented the recursive rm from completing.
|
||||
// try renaming it. it will get cleaned up eventually.
|
||||
fs.renameSync(zipDir, zipDirTmp2);
|
||||
}
|
||||
fs.mkdirSync(zipDirTmp, {
|
||||
recursive: true,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user