diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-08-17 03:55:36 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-08-17 03:55:36 +0800 |
commit | 059442e0c9f667ab73dc3eb5a9bebaa5fc6fe0f5 (patch) | |
tree | ab990640bd38d824601f915accaa4064da33ca9e /script/service | |
parent | e2987aaff16365b5ef6201b5d9139ea1543eeba3 (diff) | |
download | lua-language-server-059442e0c9f667ab73dc3eb5a9bebaa5fc6fe0f5.zip |
cleanup local cache
Diffstat (limited to 'script/service')
-rw-r--r-- | script/service/service.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/script/service/service.lua b/script/service/service.lua index c8a01a47..06558ae5 100644 --- a/script/service/service.lua +++ b/script/service/service.lua @@ -245,6 +245,23 @@ function m.testVersion() end end +function m.lockCache() + local fs = require 'bee.filesystem' + local sp = require 'bee.subprocess' + local cacheDir = string.format('%s/cache', LOGPATH) + local myCacheDir = string.format('%s/%d' + , cacheDir + , sp.get_id() + ) + fs.create_directories(fs.path(myCacheDir)) + local err + m.lockFile, err = io.open(myCacheDir .. '/.lock', 'wb') + if err then + log.error(err) + end + pub.task('removeCaches', cacheDir) +end + function m.start() util.enableCloseFunction() await.setErrorHandle(log.error) @@ -252,6 +269,7 @@ function m.start() proto.listen() m.report() m.testVersion() + m.lockCache() require 'provider' |