zola
zola copied to clipboard
vi serve change detection fix
IMPORTANT: Please do not create a Pull Request adding a new feature without discussing it first.
The place to discuss new features is the forum: https://zola.discourse.group/ If you want to add a new feature, please open a thread there first in the feature requests section.
Sanity check:
- [x] Have you checked to ensure there aren't other open Pull Requests for the same update/change?
Code changes
(Delete or ignore this section for documentation changes)
- [x] Are you doing the PR on the
next
branch?
If the change is a new feature or adding to/changing an existing one:
- [x] Have you created/updated the relevant documentation page(s)?
Fixes #2266
A little bit of code duplication going on. I made sure to leave a helpful comment explaining the extra branch.
Side note: I noticed that notify library is 2 major versions behind. Would you be interested in PRs for bumping major versions of dependencies, or don't fix what isn't broken?
it's possible vim works differently on Mac
On Mon, Aug 14, 2023, 6:04 PM Vincent Prouillet @.***> wrote:
@.**** commented on this pull request.
In src/cmd/serve.rs https://github.com/getzola/zola/pull/2269#discussion_r1294011743:
@@ -653,6 +653,29 @@ pub fn serve( }; messages::report_elapsed_time(start); }
NoticeRemove(path) => {
// Some editors, like those in the vi family, replace the file you're
vim works for me, is it only vi having issues?
— Reply to this email directly, view it on GitHub https://github.com/getzola/zola/pull/2269#pullrequestreview-1577716037, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKYK2OULK4766KR25R2FM73XVKOINANCNFSM6AAAAAA3OZABXY . You are receiving this because you authored the thread.Message ID: @.***>
I also experience this issue with NixOS + Neovim. Is there any reason why the CI is failing?
CI failure was unrelated I believe. Does this patch fix the issue for you? I want to narrow down the exact editor/OS cause for the comment to be sure it's accurate
Patch fixes it for me :+1:
Ok, probably just need to update the comment to mention it's not on Mac then
FWIW I occasionally get the following error when saving config.toml
. Restarting zola serve
fixes it but I'm not sure if it's related to this patch.
Error: Failed to build the site
Error: A base URL is required in config.toml with key `base_url`
Not sure if related but I also occasionally get this error that requires restarting:
Error: Failed to build the site
Error: Failed to open file /path/to/website/config.toml
Error: Reason: No such file or directory (os error 2)
Race condition?
Not sure if related but I also occasionally get this error that requires restarting:
Error: Failed to build the site Error: Failed to open file /path/to/website/config.toml Error: Reason: No such file or directory (os error 2)
Race condition?
Oof, it is likely. vi is essentially deleting the file and moving over a copy on top of the old one when you save. I can play with a short sleep and wait for the file to show over maybe 300ms?
I couldn't replicate the race condition locally, I did some very quick and dirty testing and there was only ever 1 try to find the new file
FWIW I occasionally get the following error when saving
config.toml
. Restartingzola serve
fixes it but I'm not sure if it's related to this patch.Error: Failed to build the site Error: A base URL is required in config.toml with key `base_url`
I'm not sure what to make of this
I'll test out the new changes and see how it goes :+1:
Looks like https://github.com/getzola/zola/pull/2269#issuecomment-1722521379 still occurs unfortunately. If it helps I'm using auto-save.nvim.
Edit: Still get https://github.com/getzola/zola/pull/2269#issuecomment-1722382730 as an error as well.
I'm fine with the original commit being merged though. It works well enough to be useful.
Looks like #2269 (comment) still occurs unfortunately. If it helps I'm using auto-save.nvim.
Edit: Still get #2269 (comment) as an error as well.
I'm fine with the original commit being merged though. It works well enough to be useful.
If my sleep and loop code doesn't fix it I should remove it before merge as it appears to have no function for me and it does not fix the intended problem. Wish I knew what to make of this, I might look at the plugin you are using but I am not sure when I will have get to that
Got a new error today where zola terminated automatically. Previously I would have to manually stop the server.
Error: Failed to build the site
Error: Failed to open file /path/to/website/config.toml
Error: Reason: No such file or directory (os error 2)
Error: Failed to serve the site
Error: Can't watch `config.toml` for changes in folder `/path/to/website`. Does it exist, and do you have correct permissions?
Error: Reason: entity not found
FWIW I'm not using the race condition patch anymore.
Is there some known docs about what weird things vi is doing? Or another tool handling it correctly?