added -f for foreground
This commit is contained in:
parent
f58ead2d29
commit
503a9b9b6c
@ -75,6 +75,7 @@ depends = "$auto"
|
||||
assets = [
|
||||
# executable
|
||||
["target/release/punchnet", "usr/local/punchnet/punchnet", "755"],
|
||||
["punchnet.service", "etc/systemd/system/punchnet.service", "755"],
|
||||
# lib
|
||||
["libtuntap.so", "usr/lib/", "755"],
|
||||
]
|
||||
|
||||
@ -315,6 +315,7 @@ fn main() {
|
||||
let cmd = CommandLineInput2::parse();
|
||||
// println!("port is {}", cmd.port);
|
||||
|
||||
let mut should_daemonize = true;
|
||||
match &cmd.cmd {
|
||||
Commands::Login(user) => {
|
||||
let rt = Runtime::new().unwrap();
|
||||
@ -402,12 +403,21 @@ fn main() {
|
||||
});
|
||||
process::exit(0);
|
||||
}
|
||||
Commands::AutoRun(runinfo) => {
|
||||
if runinfo.foreground {
|
||||
should_daemonize = false;
|
||||
}
|
||||
}
|
||||
Commands::Start(startinfo) => {
|
||||
if startinfo.foreground {
|
||||
should_daemonize = false;
|
||||
}
|
||||
}
|
||||
_other => {
|
||||
// just fall through to next code
|
||||
}
|
||||
}
|
||||
|
||||
let should_daemonize = true;
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
if should_daemonize {
|
||||
|
||||
@ -67,6 +67,9 @@ pub struct StartArguments {
|
||||
// take over dns or not if change /etc/resolv.conf
|
||||
#[arg(long)]
|
||||
pub take_dns: bool,
|
||||
|
||||
#[arg(short)]
|
||||
pub foreground: bool,
|
||||
}
|
||||
|
||||
#[derive(Args, Debug)]
|
||||
@ -110,6 +113,9 @@ pub struct AutoRunArgument {
|
||||
// take over dns or not if change /etc/resolv.conf
|
||||
#[arg(long)]
|
||||
pub take_dns: bool,
|
||||
|
||||
#[arg(short)]
|
||||
pub foreground: bool,
|
||||
}
|
||||
|
||||
#[derive(Args, Debug)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user