use proxmox_backup::tools::runtime::main to run async run_cli_command
This commit is contained in:
parent
077ac6f8b3
commit
3f06d6fbbd
|
@ -29,7 +29,7 @@ pam = "0.7"
|
|||
pam-sys = "0.5"
|
||||
percent-encoding = "2.1"
|
||||
pin-utils = "0.1.0-alpha"
|
||||
proxmox = { version = "0.1.4", features = [ "sortable-macro", "api-macro" ] }
|
||||
proxmox = { version = "0.1.5", features = [ "sortable-macro", "api-macro" ] }
|
||||
#proxmox = { git = "ssh://gitolite3@proxdev.maurer-it.com/rust/proxmox", version = "0.1.2", features = [ "sortable-macro", "api-macro" ] }
|
||||
#proxmox = { path = "../proxmox/proxmox", features = [ "sortable-macro", "api-macro" ] }
|
||||
regex = "1.2"
|
||||
|
|
|
@ -1484,7 +1484,7 @@ async fn try_get(repo: &BackupRepository, url: &str) -> Value {
|
|||
}
|
||||
|
||||
fn complete_backup_group(_arg: &str, param: &HashMap<String, String>) -> Vec<String> {
|
||||
async_main(async { complete_backup_group_do(param).await })
|
||||
proxmox_backup::tools::runtime::main(async { complete_backup_group_do(param).await })
|
||||
}
|
||||
|
||||
async fn complete_backup_group_do(param: &HashMap<String, String>) -> Vec<String> {
|
||||
|
@ -1514,7 +1514,7 @@ async fn complete_backup_group_do(param: &HashMap<String, String>) -> Vec<String
|
|||
}
|
||||
|
||||
fn complete_group_or_snapshot(arg: &str, param: &HashMap<String, String>) -> Vec<String> {
|
||||
async_main(async { complete_group_or_snapshot_do(arg, param).await })
|
||||
proxmox_backup::tools::runtime::main(async { complete_group_or_snapshot_do(arg, param).await })
|
||||
}
|
||||
|
||||
async fn complete_group_or_snapshot_do(arg: &str, param: &HashMap<String, String>) -> Vec<String> {
|
||||
|
@ -1533,7 +1533,7 @@ async fn complete_group_or_snapshot_do(arg: &str, param: &HashMap<String, String
|
|||
}
|
||||
|
||||
fn complete_backup_snapshot(_arg: &str, param: &HashMap<String, String>) -> Vec<String> {
|
||||
async_main(async { complete_backup_snapshot_do(param).await })
|
||||
proxmox_backup::tools::runtime::main(async { complete_backup_snapshot_do(param).await })
|
||||
}
|
||||
|
||||
async fn complete_backup_snapshot_do(param: &HashMap<String, String>) -> Vec<String> {
|
||||
|
@ -1564,7 +1564,7 @@ async fn complete_backup_snapshot_do(param: &HashMap<String, String>) -> Vec<Str
|
|||
}
|
||||
|
||||
fn complete_server_file_name(_arg: &str, param: &HashMap<String, String>) -> Vec<String> {
|
||||
async_main(async { complete_server_file_name_do(param).await })
|
||||
proxmox_backup::tools::runtime::main(async { complete_server_file_name_do(param).await })
|
||||
}
|
||||
|
||||
async fn complete_server_file_name_do(param: &HashMap<String, String>) -> Vec<String> {
|
||||
|
@ -1890,7 +1890,7 @@ fn mount(
|
|||
if verbose {
|
||||
// This will stay in foreground with debug output enabled as None is
|
||||
// passed for the RawFd.
|
||||
return async_main(mount_do(param, None));
|
||||
return proxmox_backup::tools::runtime::main(mount_do(param, None));
|
||||
}
|
||||
|
||||
// Process should be deamonized.
|
||||
|
@ -1906,7 +1906,7 @@ fn mount(
|
|||
Ok(ForkResult::Child) => {
|
||||
nix::unistd::close(pipe.0).unwrap();
|
||||
nix::unistd::setsid().unwrap();
|
||||
async_main(mount_do(param, Some(pipe.1)))
|
||||
proxmox_backup::tools::runtime::main(mount_do(param, Some(pipe.1)))
|
||||
}
|
||||
Err(_) => bail!("failed to daemonize process"),
|
||||
}
|
||||
|
@ -2361,13 +2361,5 @@ fn main() {
|
|||
.insert("catalog", catalog_mgmt_cli())
|
||||
.insert("task", task_mgmt_cli());
|
||||
|
||||
run_cli_command(cmd_def);
|
||||
}
|
||||
|
||||
fn async_main<F: Future>(fut: F) -> <F as Future>::Output {
|
||||
let mut rt = tokio::runtime::Runtime::new().unwrap();
|
||||
let ret = rt.block_on(fut);
|
||||
// This does not exist anymore. We need to actually stop our runaways instead...
|
||||
// rt.shutdown_now();
|
||||
ret
|
||||
proxmox_backup::tools::runtime::main(run_cli_command(cmd_def));
|
||||
}
|
||||
|
|
|
@ -459,7 +459,7 @@ fn main() {
|
|||
.completion_cb("remote-store", complete_remote_datastore_name)
|
||||
);
|
||||
|
||||
run_cli_command(cmd_def);
|
||||
proxmox_backup::tools::runtime::main(run_cli_command(cmd_def));
|
||||
}
|
||||
|
||||
// shell completion helper
|
||||
|
|
|
@ -519,5 +519,5 @@ fn main() {
|
|||
.completion_cb("archive", tools::complete_file_name)
|
||||
);
|
||||
|
||||
run_cli_command(cmd_def);
|
||||
proxmox_backup::tools::runtime::main(run_cli_command(cmd_def));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue