-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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" is broken on windows #126
Comments
@Hades32 it should continue! sounds like it's broken for you, maybe? |
I faced the same issue with watch on Windows |
reverting to tags/1.0.0 and rebuilding seems to have worked for me. compiles on save and advances to next exercise. |
@steing noted. Thank you. |
I have the same issue and #134 did not fix the problem. |
Happy to give fixing this a go if it's still broken. I have a windows vm I can debug in. |
@cjpearce That would be much appreciated! I'm honestly a bit stuck on this issue as I have neither the time or the resources to get going on this |
I've been debugging the issue and I believe that the problem is that the paths that notify is returning look something like Line 16 in 04d1d4c
I believe the solution may require using something like http://github.com/BurntSushi/same-file I have a pretty ugly patch that |
@sebsebmc That's in line with what I've found too. I think that I think one way of fixing this is to deal with constructing canonicalized the paths up front before we get into any of the logic. I'm working on a PR that would clean up how we handle the paths, which hopefully will mean it doesn't become as messy. I should have it something to show in the next day that we could test. If you get to a solution you're happy with first I'd be happy to help on that too. |
rust-lang/rust#42869 has a discussion on canonicalization on Windows. I looked up some projects that use notify and found that alacritty and xi-editor both do canonicalization for their paths. There is rust-lang/rfcs#2208 that could potentially be used in the future if it ever lands, but it seems like canonicalization should be fine and is expected to work. |
Canonicalize paths to fix path matching This PR should fix #126. The main solution to the issue was using `canonicalize()` on the paths we create for the exercises from `info.toml` and any user-specified paths, so that path `ends_with` matching will work correctly. As adding calls to the canonicalize function everywhere requires unwrapping, I also decided to extract a struct representing an exercise and use serde to deserialize the paths from the `info.toml` file up front. I also tried to move the path handling out into the `exercise.rs` file and down into `main.rs` so that it doesn't create as much clutter. There was already a lot of unwrapping and path handling in the other files and I felt like it was getting a bit too repetitive. If the approach is going too far (too many changes etc.) I'm happy to try to produce a smaller PR that fixes the bug without any refactoring.
fix watch command path execution closes rust-lang#126 @Hades32 @guttume could you test whether this works on windows by checking out the branch locally and running `cargo run watch`?
…komaeda Canonicalize paths to fix path matching This PR should fix rust-lang#126. The main solution to the issue was using `canonicalize()` on the paths we create for the exercises from `info.toml` and any user-specified paths, so that path `ends_with` matching will work correctly. As adding calls to the canonicalize function everywhere requires unwrapping, I also decided to extract a struct representing an exercise and use serde to deserialize the paths from the `info.toml` file up front. I also tried to move the path handling out into the `exercise.rs` file and down into `main.rs` so that it doesn't create as much clutter. There was already a lot of unwrapping and path handling in the other files and I felt like it was getting a bit too repetitive. If the approach is going too far (too many changes etc.) I'm happy to try to produce a smaller PR that fixes the bug without any refactoring.
…komaeda Canonicalize paths to fix path matching This PR should fix rust-lang#126. The main solution to the issue was using `canonicalize()` on the paths we create for the exercises from `info.toml` and any user-specified paths, so that path `ends_with` matching will work correctly. As adding calls to the canonicalize function everywhere requires unwrapping, I also decided to extract a struct representing an exercise and use serde to deserialize the paths from the `info.toml` file up front. I also tried to move the path handling out into the `exercise.rs` file and down into `main.rs` so that it doesn't create as much clutter. There was already a lot of unwrapping and path handling in the other files and I felt like it was getting a bit too repetitive. If the approach is going too far (too many changes etc.) I'm happy to try to produce a smaller PR that fixes the bug without any refactoring.
…komaeda Canonicalize paths to fix path matching This PR should fix rust-lang#126. The main solution to the issue was using `canonicalize()` on the paths we create for the exercises from `info.toml` and any user-specified paths, so that path `ends_with` matching will work correctly. As adding calls to the canonicalize function everywhere requires unwrapping, I also decided to extract a struct representing an exercise and use serde to deserialize the paths from the `info.toml` file up front. I also tried to move the path handling out into the `exercise.rs` file and down into `main.rs` so that it doesn't create as much clutter. There was already a lot of unwrapping and path handling in the other files and I felt like it was getting a bit too repetitive. If the approach is going too far (too many changes etc.) I'm happy to try to produce a smaller PR that fixes the bug without any refactoring.
The issue seems to be that the call to verify(...) in main.rs:92 expects the path to be in Unix style (forward slashes instead of backslashes), so the later compare breaks.
I fixed this locally by just doing a string replace, but I guess a true Rustacean will fix this much more nicely so I didn't add a patch.
PS: It's also pretty inconvenient that "watch" doesn't continue with the next exercise once you fix the current one.
The text was updated successfully, but these errors were encountered: