Skip to content

Commit 22123c1

Browse files
syrusakbaryjohn-sharrattjoseluisq
authored
refactoring: make signals support optional non-unix/windows targets (#185)
Co-authored-by: John Sharratt's Shared Account <johnathan.sharratt@gmail.com> Co-authored-by: Jose Quintana <joseluisquintana20@gmail.com>
1 parent 7ed7b03 commit 22123c1

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub mod security_headers;
2828
pub mod server;
2929
pub mod service;
3030
pub mod settings;
31+
#[cfg(any(unix, windows))]
3132
pub mod signals;
3233
pub mod static_files;
3334
#[cfg(feature = "tls")]

src/logger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn init(log_level: &str) -> Result {
1818
fn configure(level: &str) -> Result {
1919
let level = level.parse::<Level>()?;
2020

21-
#[cfg(unix)]
21+
#[cfg(not(windows))]
2222
let enable_ansi = true;
2323
#[cfg(windows)]
2424
let enable_ansi = false;

src/server.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ use std::sync::Arc;
88
use tokio::sync::oneshot::Receiver;
99

1010
use crate::handler::{RequestHandler, RequestHandlerOpts};
11+
#[cfg(any(unix, windows))]
12+
use crate::signals;
1113
#[cfg(feature = "tls")]
1214
use crate::tls::{TlsAcceptor, TlsConfigBuilder};
13-
use crate::{cors, helpers, logger, signals, Settings};
15+
use crate::{cors, helpers, logger, Settings};
1416
use crate::{service::RouterService, Context, Result};
1517

1618
/// Define a multi-thread HTTP or HTTP/2 web server.

0 commit comments

Comments
 (0)