Windows support
jasagredo opened this issue · 2 comments
Describe the feature you’d like to be implemented
Would it be possible to support Windows? Currently compilation fails with:
$ cargo install ghciwatch
...
Compiling ghciwatch v1.0.1
error[E0433]: failed to resolve: could not find `sys` in `nix`
--> C:\Users\Javier\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ghciwatch-1.0.1\src\ghci\mod.rs:5:10
|
5 | use nix::sys::signal::Signal;
| ^^^ could not find `sys` in `nix`
error[E0432]: unresolved import `nix::sys`
--> C:\Users\Javier\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ghciwatch-1.0.1\src\ghci\mod.rs:4:10
|
4 | use nix::sys::signal;
| ^^^ could not find `sys` in `nix`
error[E0432]: unresolved import `nix::unistd`
--> C:\Users\Javier\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ghciwatch-1.0.1\src\ghci\mod.rs:27:10
|
27 | use nix::unistd::Pid;
| ^^^^^^ could not find `unistd` in `nix`
error[E0433]: failed to resolve: could not find `sys` in `nix`
--> C:\Users\Javier\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ghciwatch-1.0.1\src\ghci\process.rs:9:10
|
9 | use nix::sys::signal::Signal;
| ^^^ could not find `sys` in `nix`
error[E0432]: unresolved import `nix::sys`
--> C:\Users\Javier\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ghciwatch-1.0.1\src\ghci\process.rs:8:10
|
8 | use nix::sys::signal;
| ^^^ could not find `sys` in `nix`
error[E0432]: unresolved import `nix::unistd`
--> C:\Users\Javier\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ghciwatch-1.0.1\src\ghci\process.rs:10:10
|
10 | use nix::unistd::Pid;
| ^^^^^^ could not find `unistd` in `nix`
Some errors have detailed explanations: E0432, E0433.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `ghciwatch` (lib) due to 6 previous errors
error: failed to compile `ghciwatch v1.0.1`, intermediate artifacts can be found at `C:\msys64\tmp\cargo-installd82Fgu`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
ghcid
is perfectly usable on windows, with the same caveats it has on Linux but still usable.
List alternatives to the feature and their pros and cons
No response
Additional context
No response
Windows support has been a non-goal so far. I would recommend building with Windows Subsystem for Linux. We build ghciwatch
with Nix in CI via Garnix, neither of which supports Windows, so it would mean (at a minimum) adding a new build system without any of the guarantees that Nix offers us. ghcid
also has a surprising amount of code to support Windows.
If you can get the test suite passing on Windows I'd take a look at it, but unfortunately I don't want to commit to getting it merged as I am unenthusiastic to overhaul the CI/release process.
I got a working version in jasagredo@a9a45d0, essentially just needing to modify how the Pid is passed around and how the process is killed.
It has been ~4 years since I last did some rust, so maybe my changes are not very idiomatic.
Anyways, I didn't fix the test-suite so it is probably not worth for consideration yet, but maybe someone that knows more rust than me can do a better job. That commit is just a proof that with very little changes it can work on Windows.