-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathmain.rs
More file actions
62 lines (58 loc) · 1.38 KB
/
Copy pathmain.rs
File metadata and controls
62 lines (58 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#[macro_use]
extern crate log;
mod boot_manager;
mod cli;
mod config_types;
mod daemon;
mod daemon_id;
mod daemon_list;
mod daemon_status;
mod deps;
mod env;
mod error;
mod ipc;
mod logger;
mod pitchfork_toml;
mod procs;
mod proxy;
mod settings;
mod shell;
mod state_file;
mod supervisor;
mod tui;
mod ui;
mod watch_files;
mod web;
pub use miette::Result;
#[cfg(unix)]
use tokio::signal;
#[cfg(unix)]
use tokio::signal::unix::SignalKind;
#[tokio::main]
async fn main() -> Result<()> {
// Install ring as the default rustls crypto provider.
// Required because reqwest is built with `rustls-tls-*-no-provider`, which
// avoids pulling in aws-lc-sys but requires the caller to install a provider.
let _ = rustls::crypto::ring::default_provider().install_default();
logger::init();
// Re-apply log levels now that settings (env + config files) are loaded.
// logger::init() only sees env vars; this picks up pitchfork.toml values.
logger::apply_settings();
#[cfg(unix)]
handle_epipe();
cli::run().await
}
#[cfg(unix)]
fn handle_epipe() {
match signal::unix::signal(SignalKind::pipe()) {
Ok(mut pipe_stream) => {
tokio::spawn(async move {
pipe_stream.recv().await;
debug!("received SIGPIPE");
});
}
Err(e) => {
warn!("Could not set up SIGPIPE handler: {e}");
}
}
}