You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
realpath: Resolve symlinks using realpath, defaults to true (note that if true, the file must exist previously)
This explains that the setting is true by default, and because /tmp is symlinked to /private/tmp on macOS, it produces this ENOENT problem whenever we try to use a lockfile in /tmp.
What is the official workaround for this? Disabling realpath works for me in testing. But I am unclear on what are the drawbacks of specifying realpath: false and why exactly this fails. Is realpath intended as a security measure or a convenience measure that has lower security?
I was beginning to think that manually creating the lockfile is what I'm supposed to do, but on second thought that seems to go against the notion of the lockfile itself...
The text was updated successfully, but these errors were encountered:
Error on Windows as well.
How to use this library?
Want my.lock file so process only runs once at a time...
Something like this? But it does not make the locking directory inside the folder..
varmyLock=lockfile.lock('./',{lockFilePath: './my.lock'}).then((release)=>{// Do something while the file is locked// Call the provided release function when you're done,// which will also return a promisemainprocedure().then(result=>{console.log('Finished',result)console.timeEnd('Running main import.')returnrelease()}).catch(error=>{console.error(error)console.timeEnd('Running main import.')returnrelease()})}).catch((e)=>{// either lock could not be acquired// or releasing it failedconsole.error(e)});
Based on the readme:
This explains that the setting is true by default, and because
/tmp
is symlinked to/private/tmp
on macOS, it produces this ENOENT problem whenever we try to use a lockfile in/tmp
.What is the official workaround for this? Disabling
realpath
works for me in testing. But I am unclear on what are the drawbacks of specifyingrealpath: false
and why exactly this fails. Isrealpath
intended as a security measure or a convenience measure that has lower security?I was beginning to think that manually creating the lockfile is what I'm supposed to do, but on second thought that seems to go against the notion of the lockfile itself...
The text was updated successfully, but these errors were encountered: