nvimdev / dashboard-nvim

vim dashboard
MIT License
2.22k stars 179 forks source link

Unknown file open flag 'rs+' on windows #385

Open iSplasher opened 10 months ago

iSplasher commented 10 months ago

Describe the bug I'm getting the error Error executing lua callback: ...l/nvim-data/lazy/dashboard-nvim/lua/dashboard/events.lua:27: Unknown file open flag 'rs+' during exit.

To Reproduce Steps to reproduce the behavior:

  1. Open session on windows
  2. Edit some file
  3. Quit nvim
  4. See error

Expected behavior Exiting works without error.

cybermelons commented 6 months ago

I'm on windows and ran into this error while messing with persistence.nvim and sessions. After some nvim crashed, this error started to appear.

The solution was to navigate to %USERPROFILE%/appdata/local/nvim-data/shada and and delete any main.shada.tmp files. Only main.shada would need to be there.

tox2ik commented 3 months ago

I'm also on windows and there is no %USERPROFILE%/appdata/local/nvim-data/shada/main.shada.tmp file. I don't think it's related.

This seems to fix it:

file: dashboard-nvim\lua\dashboard\events.lua

25      -- callback hell holy shit but simply than write a async await lib
26      -- also I don't link to add a thirdpart plugin. this is just a small code
27      uv.fs_open(path, 'r+', 384, function(err, fd)
28        assert(not err, "Cannot open «"..path.."»: " .. err)

The comments above imply that asynchronous mode is used, otherwise there would be no need for callbacks. However, the flags rs+ and specifically the s means synchronous as far as I understand. Requesting an open() operation with the sync flag is nonsensical in this context, thus the error message: Unknown file open flag 'rs+'

if it matters, the file it was trying to open was:

C:\Users\boss\AppData\Local\Temp\nvim\dashboard\cache