Repository: static-web-server/static-web-server (language: rust)

Issue:
Make compilation work in systems without signals
Signals are not always available in all the target systems.

Ideally, we would only use signals in the systems that support it (that is, unix and windows as they are currently the main ones supported on this repo)


Discussion / hints:

Fix patch:
diff --git a/src/lib.rs b/src/lib.rs
index 5f32657d..f3954859 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -28,6 +28,7 @@ pub mod security_headers;
 pub mod server;
 pub mod service;
 pub mod settings;
+#[cfg(any(unix, windows))]
 pub mod signals;
 pub mod static_files;
 #[cfg(feature = "tls")]
diff --git a/src/logger.rs b/src/logger.rs
index 1540a4cf..ac666bf3 100644
--- a/src/logger.rs
+++ b/src/logger.rs
@@ -18,7 +18,7 @@ pub fn init(log_level: &str) -> Result {
 fn configure(level: &str) -> Result {
     let level = level.parse::<Level>()?;
 
-    #[cfg(unix)]
+    #[cfg(not(windows))]
     let enable_ansi = true;
     #[cfg(windows)]
     let enable_ansi = false;
diff --git a/src/server.rs b/src/server.rs
index 65ed7c46..3fb66bfa 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -8,9 +8,11 @@ use std::sync::Arc;
 use tokio::sync::oneshot::Receiver;
 
 use crate::handler::{RequestHandler, RequestHandlerOpts};
+#[cfg(any(unix, windows))]
+use crate::signals;
 #[cfg(feature = "tls")]
 use crate::tls::{TlsAcceptor, TlsConfigBuilder};
-use crate::{cors, helpers, logger, signals, Settings};
+use crate::{cors, helpers, logger, Settings};
 use crate::{service::RouterService, Context, Result};
 
 /// Define a multi-thread HTTP or HTTP/2 web server.


Test patch: