mux: fix initial creation of pid file in mux server
We need to create the directory structure that we want to place the pid file into.
This commit is contained in:
1 parent
ebd4f4aa06
commit
ab0a4fc2d2
2 files changed
+10
-2
No files matched your search
@@ -37,6 +37,15 @@ fn setsid() -> anyhow::Result<()> {
|
||||
|
||||
fn lock_pid_file(config: &config::ConfigHandle) -> anyhow::Result<std::fs::File> {
|
||||
let pid_file = config.daemon_options.pid_file();
|
||||
let pid_file_dir = pid_file
|
||||
.parent()
|
||||
.ok_or_else(|| anyhow::anyhow!("{} has no parent?", pid_file.display()))?;
|
||||
std::fs::create_dir_all(&pid_file_dir).with_context(|| {
|
||||
format!(
|
||||
"while creating directory structure: {}",
|
||||
pid_file_dir.display()
|
||||
)
|
||||
})?;
|
||||
let file = std::fs::OpenOptions::new()
|
||||
.create(true)
|
||||
.write(true)
|
||||
|
||||
@@ -47,8 +47,7 @@ struct Opt {
|
||||
fn main() {
|
||||
pretty_env_logger::init_timed();
|
||||
if let Err(err) = run() {
|
||||
eprintln!("boo {}", err);
|
||||
log::error!("{}", err);
|
||||
log::error!("{:#}", err);
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user