ITADN

Live reload doesn't detect link swap

#161Closeddtomvan 创建于 2025-06-12
bug
D
dtomvancommented
As discovered in: https://github.com/NixOS/nixpkgs/pull/409766#issuecomment-2967531002 #### MVRE ```ShellSession $ cd $(mktemp -d) $ mkdir source $ echo "aaa" >> source/a.html $ ln -s source target $ live-server --open=/a.html target & [...] ( "aaa" is shown ) $ cp -r source source-2 $ echo "bbb" >> source-2/a.html $ rm target $ ln -s source-2 target ``` #### Expected The server should reload, as technically the contents of `target` have changed, as far as `ls` is concerned. #### Actual The server dereferences the symlink and only keeps looking at the old state. This is especially painful for when nix builds are used to generate some HTML, as is done in the above PR. `--hard` does not help here. #### Proposed solution I tried to implement it myself, but this may require a lot of refactoring, as all of the code expects only a single (albeit recursive) file watch. It should also watch the parent directory for whether or not the root directory changed by swapping it out for a different link.
关闭于 2025-06-15 2 条评论