@rushstack/node-core-library
Advanced tools
Comparing version 3.65.0 to 3.66.0
@@ -0,1 +1,2 @@ | ||
import type { FileSystemStats } from './FileSystem'; | ||
/** | ||
@@ -60,3 +61,8 @@ * Interface which represents the flags about which mode the file should be opened in. | ||
close(): void; | ||
/** | ||
* Gets the statistics for the given file handle. Throws if the file handle has been closed. | ||
* Behind the scenes it uses `fs.statSync()`. | ||
*/ | ||
getStatistics(): FileSystemStats; | ||
} | ||
//# sourceMappingURL=FileWriter.d.ts.map |
@@ -61,4 +61,14 @@ "use strict"; | ||
} | ||
/** | ||
* Gets the statistics for the given file handle. Throws if the file handle has been closed. | ||
* Behind the scenes it uses `fs.statSync()`. | ||
*/ | ||
getStatistics() { | ||
if (!this._fileDescriptor) { | ||
throw new Error(`Cannot get file statistics, file descriptor has already been released.`); | ||
} | ||
return fsx.fstatSync(this._fileDescriptor); | ||
} | ||
} | ||
exports.FileWriter = FileWriter; | ||
//# sourceMappingURL=FileWriter.js.map |
@@ -256,3 +256,3 @@ "use strict"; | ||
lockFileHandle.write(startTime); | ||
const currentBirthTimeMs = FileSystem_1.FileSystem.getStatistics(pidLockFilePath).birthtime.getTime(); | ||
const currentBirthTimeMs = lockFileHandle.getStatistics().birthtime.getTime(); | ||
let smallestBirthTimeMs = currentBirthTimeMs; | ||
@@ -282,4 +282,7 @@ let smallestBirthTimePid = pid.toString(); | ||
} | ||
catch (err) { | ||
// this means the file is probably deleted already | ||
catch (error) { | ||
if (FileSystem_1.FileSystem.isNotExistError(error)) { | ||
// the file is already deleted by other process, skip it | ||
continue; | ||
} | ||
} | ||
@@ -286,0 +289,0 @@ // if the otherPidOldStartTime is invalid, then we should look at the timestamp, |
{ | ||
"name": "@rushstack/node-core-library", | ||
"version": "3.65.0", | ||
"version": "3.66.0", | ||
"description": "Core libraries that every NodeJS toolchain project should use", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1177541
15238