Improve error message when socket not found (#412)

This commit is contained in:
Firstyear 2021-04-14 10:28:00 +10:00 committed by GitHub
parent 72dfe1b035
commit d4f852837b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,6 +13,7 @@ extern crate log;
use log::debug; use log::debug;
use structopt::StructOpt; use structopt::StructOpt;
use std::path::PathBuf;
// use futures::executor::block_on; // use futures::executor::block_on;
@ -44,6 +45,10 @@ fn main() {
let req = ClientRequest::Status; let req = ClientRequest::Status;
let spath = PathBuf::from(cfg.sock_path.as_str());
if !spath.exists() {
error!("kanidm_unixd socket {} does not exist - is the service running?", cfg.sock_path)
} else {
match call_daemon_blocking(cfg.sock_path.as_str(), req) { match call_daemon_blocking(cfg.sock_path.as_str(), req) {
Ok(r) => match r { Ok(r) => match r {
ClientResponse::Ok => info!("working!"), ClientResponse::Ok => info!("working!"),
@ -55,4 +60,5 @@ fn main() {
error!("Error -> {:?}", e); error!("Error -> {:?}", e);
} }
} }
}
} }