mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-12 20:57:26 +08:00
fix cargo install failure (#1054)
This commit is contained in:
8
Cargo.lock
generated
8
Cargo.lock
generated
@@ -4118,7 +4118,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7325,8 +7325,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "service-manager"
|
||||
version = "0.7.1"
|
||||
source = "git+https://github.com/chipsenkbeil/service-manager-rs.git?branch=main#13dae5e8160f91fdc9834d847165cc5ce0a72fb3"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/chipsenkbeil/service-manager-rs.git?branch=main#0294d3b9769c8ef7db8b4e831fb1c4f14b7d473b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"dirs 4.0.0",
|
||||
@@ -9696,7 +9696,7 @@ version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -185,8 +185,11 @@ struct InstallArgs {
|
||||
#[arg(long)]
|
||||
display_name: Option<String>,
|
||||
|
||||
#[arg(long, default_value = "false")]
|
||||
disable_autostart: bool,
|
||||
#[arg(long)]
|
||||
disable_autostart: Option<bool>,
|
||||
|
||||
#[arg(long)]
|
||||
disable_restart_on_failure: Option<bool>,
|
||||
|
||||
#[arg(long, help = "path to easytier-core binary")]
|
||||
core_path: Option<PathBuf>,
|
||||
@@ -697,6 +700,7 @@ impl CommandHandler<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ServiceInstallOptions {
|
||||
pub program: PathBuf,
|
||||
pub args: Vec<OsString>,
|
||||
@@ -704,6 +708,7 @@ pub struct ServiceInstallOptions {
|
||||
pub disable_autostart: bool,
|
||||
pub description: Option<String>,
|
||||
pub display_name: Option<String>,
|
||||
pub disable_restart_on_failure: bool,
|
||||
}
|
||||
pub struct Service {
|
||||
lable: ServiceLabel,
|
||||
@@ -720,6 +725,8 @@ impl Service {
|
||||
let service_manager = <dyn ServiceManager>::native()?;
|
||||
let kind = ServiceManagerKind::native()?;
|
||||
|
||||
println!("service manager kind: {:?}", kind);
|
||||
|
||||
Ok(Self {
|
||||
lable: name.parse()?,
|
||||
kind,
|
||||
@@ -737,6 +744,7 @@ impl Service {
|
||||
username: None,
|
||||
working_directory: Some(options.work_directory.clone()),
|
||||
environment: None,
|
||||
disable_restart_on_failure: options.disable_restart_on_failure,
|
||||
};
|
||||
if self.status()? != ServiceStatus::NotInstalled {
|
||||
return Err(anyhow::anyhow!(
|
||||
@@ -1231,10 +1239,14 @@ async fn main() -> Result<(), Error> {
|
||||
program: bin_path,
|
||||
args: bin_args,
|
||||
work_directory: work_dir,
|
||||
disable_autostart: install_args.disable_autostart,
|
||||
disable_autostart: install_args.disable_autostart.unwrap_or(false),
|
||||
description: Some(install_args.description),
|
||||
display_name: install_args.display_name,
|
||||
disable_restart_on_failure: install_args
|
||||
.disable_restart_on_failure
|
||||
.unwrap_or(false),
|
||||
};
|
||||
println!("install_options: {:#?}", install_options);
|
||||
service.install(&install_options)?;
|
||||
}
|
||||
ServiceSubCommand::Uninstall => {
|
||||
|
||||
Reference in New Issue
Block a user