romgrk / barbar.nvim

The neovim tabline plugin.
2.17k stars 82 forks source link

barbar.json: No such file or directory when running in headless mode #462

Closed GaetanLepage closed 1 year ago

GaetanLepage commented 1 year ago

Description

It is not blocking at all, I am just unable to understand why this "bug" occurs.

When running neovim (with barbar installed) in headless mode and when the XDG_CACHE_HOME/nvim folder does not exist. i.e.:

  1. ./test_cache/nvim exists a. XDG_CACHE_HOME=./test_cache nvim "+q" -> works (no error) b. XDG_CACHE_HOME=./test_cache nvim --headless "+q" -> works (no error)
  2. ./test_cache/nvim does NOT exist a. XDG_CACHE_HOME=./test_cache nvim "+q" -> works (no error) b. XDG_CACHE_HOME=./test_cache nvim --headless "+q" -> errors:
    ❮ XDG_CACHE_HOME=/i_dont_exist ./result/bin/nvim --headless "+q"
    Error detected while processing command line..VimLeave Autocommands for "*":
    /i_dont_exist/nvim/barbar.json: No such file or directory%

This bug was discovered in an automatic testing context. I agree that it makes no sense running neovim in headless mode with barbar. I was just wondering why this is happening. To fix our tests, we can manually create a fake cache folder, but I feel like we shouldn't have to do this.

GaetanLepage commented 1 year ago

Ok, after some investigations I found out that the error is not specific to headless. It is just that it is not shown when not running headless. By exporting the runtime logs of neovim, the error appears.

I guess that the behavior (i.e. throw an error if the cache folder does not exist) is expected.