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