-
-
Notifications
You must be signed in to change notification settings - Fork 105
-
-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Watch mode does not work when the file is momentarily deleted then re-created #498
Comments
I've tested steps for reproduce on Arch Linux, but cannot reproduce in my environment.
I could not confirm that too. When a watching file is deleted and re-created, my Marp CLI have watched the created file again and generate new HTML.
As described in #267 (comment), increasing the amount of inotify watchers may resolve the watcher's stop. Appendix: https://gist.github.com/coenraadhuman/fa7345e95a9b4dea851dbe9e8f011470 |
Increasing the amount of inotify watchers doesn't help. I think it's some race condition, I try using this C program to modify the file: #include<stdio.h>
#include<stdlib.h>
#include <unistd.h>
int main(){
char buffer[4096];
/*
int fd = open("/home/user202729/solution.md", O_RDONLY);
int numRead = read(fd, buffer, 4096);
close(fd);
*/
// use fopen
FILE *fp = fopen("/home/user202729/solution.md", "r");
int numRead = fread(buffer, 1, 4096, fp);
fclose(fp);
unlink("/home/user202729/solution.md");
//sleep(1); // if this is uncommented, the bug does not happen
fp = fopen("/home/user202729/solution.md", "w");
++buffer[0];
fwrite(buffer, 1, numRead, fp);
fclose(fp);
} apart from the first time the file is modified, marp does not detect the change. But if I uncomment the So I think the Not sure why you cannot reproduce it with your vim version. The bug is indeed infrequent, I cannot completely reliably reproduce it. |
Marp just uses chokidar to watch file(s), so in reality Marp may not be able to do anything. Consider to report that into chokidar issue tracker.
|
Close for cleaning up Marp CLI issue tracker. Again: Please report this to chokidar, a file watcher Marp CLI is using. |
Version of Marp Tool
@marp-team/marp-cli v2.2.2 (w/ @marp-team/marp-core v3.4.0)
Operating System
Linux
Environment
Linux archlinux 6.0.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 16 Nov 2022 17:01:17 +0000 x86_64 GNU/Linux
How to reproduce
marp --watch
compile that fileExpected behavior
That it recompiles every time the file is edited.
Actual behavior
See "how to reproduce" section.
Additional information
As mentioned above, I suspect the cause is that vim momentarily delete the file then re-create it, which breaks the watching logic of Marp.
Using something such as
echo 1 > solution.md
works fine.The text was updated successfully, but these errors were encountered: