@jsenv/util
Advanced tools
Comparing version 3.7.2 to 3.7.3
{ | ||
"name": "@jsenv/util", | ||
"version": "3.7.2", | ||
"version": "3.7.3", | ||
"description": "Set of functions often needed when using Node.js.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,2 +0,2 @@ | ||
import { lstat, stat, existsSync } from "fs" | ||
import { lstat, stat } from "fs" | ||
import { assertAndNormalizeFileUrl } from "./assertAndNormalizeFileUrl.js" | ||
@@ -30,6 +30,8 @@ import { urlToFileSystemPath } from "./urlToFileSystemPath.js" | ||
handlePermissionDeniedError: async (error) => { | ||
// unfortunately it means we mutate the permissions | ||
// without being able to restore them to the previous value | ||
// (because reading current permission would also throw) | ||
console.error(`trying to fix windows EPERM after stats on ${sourcePath}`) | ||
try { | ||
// unfortunately it means we mutate the permissions | ||
// without being able to restore them to the previous value | ||
// (because reading current permission would also throw) | ||
await writeFileSystemNodePermissions(sourceUrl, 0o666) | ||
@@ -41,2 +43,3 @@ const stats = await readStat(sourcePath, { | ||
handlePermissionDeniedError: () => { | ||
console.error(`still got EPERM after stats on ${sourcePath}`) | ||
throw error | ||
@@ -47,3 +50,5 @@ }, | ||
} catch (e) { | ||
// failed to write permission or readState, throw original error as well | ||
console.error( | ||
`error while trying to fix windows EPERM after stats on ${sourcePath}: ${e.stack}`, | ||
) | ||
throw error | ||
@@ -66,6 +71,3 @@ } | ||
if (error) { | ||
if ( | ||
handleNotFoundError && | ||
(error.code === "ENOENT" || (error.code === "EPERM" && !existsSync(sourcePath))) | ||
) { | ||
if (handleNotFoundError && error.code === "ENOENT") { | ||
resolve(handleNotFoundError(error)) | ||
@@ -72,0 +74,0 @@ } else if ( |
@@ -142,2 +142,4 @@ import { unlink, rmdir, openSync, closeSync } from "fs" | ||
handlePermissionError: async (error) => { | ||
console.error(`trying to fix windows EPERM after readir on ${directoryPath}`) | ||
let openOrCloseError | ||
@@ -155,3 +157,5 @@ try { | ||
} | ||
console.error(`error while trying to fix windows EPERM: ${openOrCloseError.stack}`) | ||
console.error( | ||
`error while trying to fix windows EPERM after readir on ${directoryPath}: ${openOrCloseError.stack}`, | ||
) | ||
throw error | ||
@@ -158,0 +162,0 @@ } |
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
280433
4791