diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/fs/lua.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index f64b0c18..5c369648 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
| @@ -301,8 +301,16 @@ end | |||
| 301 | 301 | ||
| 302 | function fs_lua.lock_access(dirname, force) | 302 | function fs_lua.lock_access(dirname, force) |
| 303 | fs.make_dir(dirname) | 303 | fs.make_dir(dirname) |
| 304 | local lockfile = dir.path(dirname, "lockfile.lfs") | ||
| 305 | |||
| 306 | -- drop stale lock, older than 1 hour | ||
| 307 | local age = fs.file_age(lockfile) | ||
| 308 | if age > 3600 and age < math.huge then | ||
| 309 | force = true | ||
| 310 | end | ||
| 311 | |||
| 304 | if force then | 312 | if force then |
| 305 | os.remove(dir.path(dirname, "lockfile.lfs")) | 313 | os.remove(lockfile) |
| 306 | end | 314 | end |
| 307 | return lfs.lock_dir(dirname) | 315 | return lfs.lock_dir(dirname) |
| 308 | end | 316 | end |
