@salesforce/core 8.8.3 → 8.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/util/fileLocking.js +2 -16
- package/package.json +1 -1
package/lib/util/fileLocking.js
CHANGED
|
@@ -55,14 +55,7 @@ const lockInit = async (filePath) => {
|
|
|
55
55
|
catch (err) {
|
|
56
56
|
throw sfError_1.SfError.wrap(err);
|
|
57
57
|
}
|
|
58
|
-
const
|
|
59
|
-
? // if the file exists, wait for it to be unlocked
|
|
60
|
-
[(0, proper_lockfile_1.lock)(filePath, lockRetryOptions_1.lockRetryOptions)]
|
|
61
|
-
: // lock the entire directory to keep others from trying to create the file while we are
|
|
62
|
-
[
|
|
63
|
-
(0, proper_lockfile_1.lock)((0, node_path_1.dirname)(filePath), lockRetryOptions_1.lockRetryOptions),
|
|
64
|
-
(await logger_1.Logger.child('fileLocking.lockInit')).debug(`No file found at ${filePath}. Write will create it. Locking the entire directory until file is written.`),
|
|
65
|
-
]);
|
|
58
|
+
const unlock = await (0, proper_lockfile_1.lock)(filePath, { ...lockRetryOptions_1.lockRetryOptions, realpath: false });
|
|
66
59
|
return {
|
|
67
60
|
writeAndUnlock: async (data) => {
|
|
68
61
|
const logger = await logger_1.Logger.child('fileLocking.writeAndUnlock');
|
|
@@ -90,14 +83,7 @@ const lockInitSync = (filePath) => {
|
|
|
90
83
|
catch (err) {
|
|
91
84
|
throw sfError_1.SfError.wrap(err);
|
|
92
85
|
}
|
|
93
|
-
const
|
|
94
|
-
? // if the file exists, wait for it to be unlocked
|
|
95
|
-
[(0, proper_lockfile_1.lockSync)(filePath, lockRetryOptions_1.lockOptions)]
|
|
96
|
-
: // lock the entire directory to keep others from trying to create the file while we are
|
|
97
|
-
[
|
|
98
|
-
(0, proper_lockfile_1.lockSync)((0, node_path_1.dirname)(filePath), lockRetryOptions_1.lockOptions),
|
|
99
|
-
logger_1.Logger.childFromRoot('fileLocking.lockInit').debug(`No file found at ${filePath}. Write will create it. Locking the entire directory until file is written.`),
|
|
100
|
-
];
|
|
86
|
+
const unlock = (0, proper_lockfile_1.lockSync)(filePath, { ...lockRetryOptions_1.lockOptions, realpath: false });
|
|
101
87
|
return {
|
|
102
88
|
writeAndUnlock: (data) => {
|
|
103
89
|
const logger = logger_1.Logger.childFromRoot('fileLocking.writeAndUnlock');
|