executing the dummy cmd in async context
This commit is contained in:
Generated
+1
@@ -7603,6 +7603,7 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"nix 0.27.1",
|
||||
"nym-bin-common",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -15,5 +15,6 @@ anyhow = { workspace = true }
|
||||
clap = { workspace = true, features = ["derive"] }
|
||||
lazy_static = { workspace = true }
|
||||
nix = "0.27.1"
|
||||
tokio = { workspace = true, features = ["rt", "macros", "signal", "process"] }
|
||||
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["output_format"] }
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use nym_bin_common::output_format::OutputFormat;
|
||||
|
||||
#[derive(clap::Args, Debug)]
|
||||
pub(crate) struct Args {
|
||||
//
|
||||
#[clap(short, long, default_value_t = OutputFormat::default())]
|
||||
output: OutputFormat,
|
||||
}
|
||||
|
||||
pub(crate) fn execute(args: Args) -> anyhow::Result<()> {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use nym_bin_common::output_format::OutputFormat;
|
||||
|
||||
#[derive(clap::Args, Debug)]
|
||||
pub(crate) struct Args {
|
||||
//
|
||||
#[clap(short, long, default_value_t = OutputFormat::default())]
|
||||
output: OutputFormat,
|
||||
}
|
||||
|
||||
pub(crate) fn execute(args: Args) -> anyhow::Result<()> {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use nym_bin_common::output_format::OutputFormat;
|
||||
|
||||
#[derive(clap::Args, Debug)]
|
||||
pub(crate) struct Args {
|
||||
//
|
||||
#[clap(short, long, default_value_t = OutputFormat::default())]
|
||||
output: OutputFormat,
|
||||
}
|
||||
|
||||
pub(crate) fn execute(args: Args) -> anyhow::Result<()> {
|
||||
|
||||
@@ -43,9 +43,18 @@ impl Cli {
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
pub(crate) enum Commands {
|
||||
/// TODO: document the command
|
||||
Init(init::Args),
|
||||
|
||||
/// TODO: document the command
|
||||
Run(run::Args),
|
||||
|
||||
/// TODO: document the command
|
||||
BuildInfo(build_info::Args),
|
||||
|
||||
/// TODO: document the command
|
||||
AddUpgrade(add_upgrade::Args),
|
||||
|
||||
/// TODO: document the command
|
||||
Config(config::Args),
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use tokio::runtime;
|
||||
|
||||
#[derive(clap::Args, Debug)]
|
||||
pub(crate) struct Args {
|
||||
#[clap(trailing_var_arg = true)]
|
||||
@@ -9,14 +11,20 @@ pub(crate) struct Args {
|
||||
}
|
||||
|
||||
pub(crate) fn execute(args: Args) -> anyhow::Result<()> {
|
||||
println!("run");
|
||||
// TODO: experiment with the minimal runtime
|
||||
let rt = runtime::Builder::new_current_thread().enable_io().build()?;
|
||||
|
||||
let mut child = std::process::Command::new("echo")
|
||||
.args(args.daemon_args)
|
||||
.spawn()?;
|
||||
// spawn the root task
|
||||
rt.block_on(async {
|
||||
println!("run");
|
||||
|
||||
let status = child.wait()?;
|
||||
let mut child = tokio::process::Command::new("echo")
|
||||
.args(args.daemon_args)
|
||||
.spawn()?;
|
||||
|
||||
println!("{:?}", status);
|
||||
Ok(())
|
||||
let status = child.wait().await?;
|
||||
|
||||
println!("{:?}", status);
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user