Skip to content

Commit

Permalink
fix: linux config file
Browse files Browse the repository at this point in the history
  • Loading branch information
hlhr202 committed Apr 17, 2024
1 parent 3207057 commit 111c790
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/openconnect-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,19 @@ fn main() {
Commands::Start { name, config_file } => {
sock::exit_when_socket_exists();

#[cfg(target_os = "macos")]
sudo::escalate_if_needed().expect("Failed to escalate permissions");

#[cfg(target_os = "linux")]
sudo::with_env(&["HOME"]).expect("Failed to escalate permissions"); // keep HOME env so that we can find the config file and vpnc script

let config_file = config_file.map(PathBuf::from).unwrap_or(
StoredConfigs::getorinit_config_file().expect("Failed to get config file"),
);

sudo::escalate_if_needed().expect("Failed to escalate permissions");

match daemon::daemonize() {
daemon::ForkResult::Parent => {
println!("Using Config file: {:?}", config_file);
crate::client::state::request_start_server(name, config_file);
println!("The process will be running in the background, you should use cli to interact with it.");
std::process::exit(0);
Expand Down

0 comments on commit 111c790

Please sign in to comment.