Open davepacheco opened 3 years ago
Windows is kind of a secondary platform, since its support of signals is very limited. Parts of the crate are not available there as a result. You can turn these parts off by default-features = false
and picking only the things you need.
You're right that it probably should build with the defaults and just have them unavailable there. I'll get around to fixing that eventually, but probably not right now. I'd suggest you use the workaround above in the meantime, but if you want to get involved and fix it, I'll be happy for a PR.
Thanks for reporting it.
No problem. I understand it's best-effort. My use case is very simple so I wound up using the ctrlc
crate for now.
I'm looking into it right now. The signal-hook
with default features builds OK on windows (well, with some warnings about unused imports, but :shrug:). But the signal-hook-tokio depends on the iterator feature and that one isn't ported to windows, so signal-hook-tokio is incompatible with windows.
I admit the error should be a bit better though, but I don't see a good way how to do it :-|.
https://github.com/helix-editor/helix/pull/464/checks?check_run_id=3093468552
We also get that on iterator, I think a workaround is remove signal-hook-tokio for windows.
Tokio has a cross-platform ctrl-c signal handler, for those looking for a basic graceful shutdown feature: https://docs.rs/tokio/1.34.0/tokio/signal/fn.ctrl_c.html
I created a crate that's basically empty and depends on signal-hook and signal-hook-tokio: https://github.com/davepacheco/signal-hook-windows-test/blob/main/Cargo.toml
I have GitHub Actions configured to build this on Ubuntu, Windows, and MacOS. The Ubuntu one works, but the Windows one failed. (The MacOS one was aborted because of the Windows failure.) I've only tested this once here, but I see the same behavior in a bigger crate that uses these crates.
The error is here: