Skip to content

Commit

Permalink
Relative paths (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranciszkiewicz committed Mar 23, 2021
1 parent b5a799b commit 227a63f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 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.0"
version = "0.2.1"
authors = ["Golem Factory <contact@golem.network>"]
edition = "2018"
repository = "https://github.com/golemfactory/ya-runtime-dbg"
Expand Down
22 changes: 19 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ struct Args {
}

impl Args {
fn canonicalize(&mut self) -> Result<()> {
self.runtime = self
.runtime
.canonicalize()
.context(format!("runtime not found: {:?}", self.runtime))?;
self.workdir = self
.workdir
.canonicalize()
.context(format!("workdir not found: {:?}", self.workdir))?;
self.task_package = self
.task_package
.canonicalize()
.context(format!("task package not found: {:?}", self.task_package))?;
Ok(())
}

fn to_runtime_args(&self) -> Vec<OsString> {
let mut args = vec![
OsString::from("--workdir"),
Expand Down Expand Up @@ -182,7 +198,6 @@ where

ui_info!(ui, "Deploying");

let _ = create_dir_all(&args.workdir);
let mut child = runtime_command(&args)?
.kill_on_drop(true)
.args(rt_args)
Expand Down Expand Up @@ -318,13 +333,14 @@ fn is_broken_pipe(message: &str) -> bool {
#[actix_rt::main]
async fn main() -> Result<()> {
let mut args = Args::from_args();
args.runtime = args.runtime.canonicalize().context("runtime not found")?;
let exec_mode = ExecMode::new(args.exec_mode, args.exec_shell.clone());
let _ = create_dir_all(&args.workdir);

let proj_dir = project_dir()?;
let history_path = proj_dir.join(".ya_dbg_history");
let exec_mode = ExecMode::new(args.exec_mode, args.exec_shell.clone());
let mut ui = ui(history_path, &exec_mode.to_string())?;

args.canonicalize()?;
let rt_args = args
.to_runtime_args()
.into_iter()
Expand Down

0 comments on commit 227a63f

Please sign in to comment.