Skip to content

Commit

Permalink
ref: 优化修复问题
Browse files Browse the repository at this point in the history
  • Loading branch information
SerenitySir committed May 22, 2024
1 parent d80561b commit f0330ad
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/core/nal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ pub fn init_config() -> NalConfig {
pub fn get_no_proxy_client() -> Client {
Client::builder()
.no_proxy() // 禁用代理
.connect_timeout(Duration::from_secs(10))
.timeout(Duration::from_secs(30))
.build().unwrap()
}
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ async fn main() {
return;
}
if cli.uninstall {
service.stop();
service.uninstall();
return;
}
Expand Down
8 changes: 4 additions & 4 deletions src/util/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use clap_derive::Parser;
#[derive(Parser)]
#[command(version, about, long_about = None)]
pub struct Cli {
#[arg(short = 'i')]
#[arg(short = 'i', long)]
pub install: bool,

#[arg(short,long)]
#[arg(short, long)]
pub uninstall: bool,

#[arg(long)]
Expand All @@ -15,6 +15,6 @@ pub struct Cli {
#[arg(long)]
pub stop: bool,

#[arg(short,long)]
pub run: bool
#[arg(short, long)]
pub run: bool,
}
3 changes: 2 additions & 1 deletion src/util/service.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::env;
use std::ffi::OsString;
use std::path::PathBuf;
use log::{debug, info};
use service_manager::{ServiceInstallCtx, ServiceLabel, ServiceManager, ServiceStartCtx, ServiceStopCtx, ServiceUninstallCtx};
Expand Down Expand Up @@ -40,7 +41,7 @@ impl Service {
self.service_manage.install(ServiceInstallCtx {
label: self.name.clone(),
program: self.path.clone(),
args: vec![],
args: vec![OsString::from("--run")],
contents: None, // 特定于系统的服务内容的可选字符串。
username: None, // 可选字符串,供备用用户运行服务。
working_directory: None, // 服务进程的工作目录的可选字符串。
Expand Down

0 comments on commit f0330ad

Please sign in to comment.