mirror of
https://github.com/wavetermdev/inshellisense.git
synced 2026-08-05 13:43:30 -07:00
fix: prevent no cache file from crashing startup
Signed-off-by: cpendery <cpendery@vt.edu>
This commit is contained in:
@@ -53,7 +53,10 @@ func ClearResult() {
|
||||
if err != nil {
|
||||
slog.Error("failed to load cache file", slog.String("error", err.Error()))
|
||||
}
|
||||
if err := os.Truncate(path, 0); err != nil {
|
||||
slog.Error("failed to clear cache file", slog.String("error", err.Error()))
|
||||
os.Stat(path)
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
if err := os.Truncate(path, 0); err != nil {
|
||||
slog.Error("failed to clear cache file", slog.String("error", err.Error()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user