Skip to content

Commit

Permalink
Ability to pass additional DEPLOY or START arguments (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranciszkiewicz committed Jun 8, 2021
1 parent 6795003 commit b102b9e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ya-runtime-dbg"
version = "0.2.2"
version = "0.2.3"
authors = ["Golem Factory <contact@golem.network>"]
edition = "2018"
repository = "https://github.com/golemfactory/ya-runtime-dbg"
Expand Down
21 changes: 13 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ struct Args {
parse(from_flag = std::ops::Not::not),
)]
deploy: bool,
/// Additional DEPLOY command arguments
#[structopt(long, multiple = true)]
deploy_arg: Vec<String>,
/// Additional START command arguments
#[structopt(long, multiple = true)]
start_arg: Vec<String>,
/// Additional runtime arguments
varargs: Vec<String>,
}
Expand Down Expand Up @@ -200,14 +206,13 @@ async fn deploy<T>(args: &Args, ui: UI<T>) -> Result<()>
where
T: Terminal + 'static,
{
let mut rt_args = args.to_runtime_args();
rt_args.push(OsString::from("deploy"));

ui_info!(ui, "Deploying");

let mut child = runtime_command(&args)?
.kill_on_drop(true)
.args(rt_args)
.args(args.to_runtime_args())
.arg("deploy")
.args(&args.deploy_arg)
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()?;
Expand Down Expand Up @@ -235,13 +240,13 @@ async fn start<T>(
where
T: Terminal + 'static,
{
let mut rt_args = args.to_runtime_args();
rt_args.push(OsString::from("start"));

ui_info!(ui, "Starting");

let mut command = runtime_command(&args)?;
command.args(rt_args);
command
.args(args.to_runtime_args())
.arg("start")
.args(args.start_arg);

let (tx, mut rx) = mpsc::channel(1);
let service = spawn(command, EventHandler::new(tx, ui.clone()))
Expand Down

0 comments on commit b102b9e

Please sign in to comment.