moxystudio/node-proper-lockfile

The lib doesn't work as expected, or I don't understand it's purpose

jsonslim opened this issue · 1 comments

OS: Windows 10
Node.js version: 16.14.2

`const lockfile = require('proper-lockfile');
const fs = require('fs');

     lockfile.lock('./file.txt')

     .then((release)=>{             
         fs.writeFileSync('./file.txt', 'some text');
         return release();
     })    
     .catch((e) => {
        console.error(e)
    }); 

`

I expected that the file.txt will NOT be written, but it actually is. If the code doesn't protect the file from be written, what is the purpose of the library? Thanks!

@SpacewormSera i also have the same issue, it doesn't seem to work for me too. May i ask if you have any resolution to share as you have closed this issue. Thanks.