Skip to content

Commit

Permalink
Update rox commands to use sh to run arbitrary commands (#3)
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas La Piana <tlapiana@pm.me>
  • Loading branch information
ThomasLaPiana and Thomas La Piana authored Nov 25, 2023
1 parent 1302764 commit a6849f1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
12 changes: 12 additions & 0 deletions rox.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"rust-analyzer.linkedProjects": [
"./Cargo.toml"
]
}
}
10 changes: 5 additions & 5 deletions src/execution.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! This is the module responsible for executing tasks.
use crate::models::Task;
use crate::utils;
use std::collections::HashMap;
use std::process::{Command, ExitStatus};

Expand Down Expand Up @@ -43,12 +42,13 @@ pub fn run_task(task: &Task) -> TaskResult {
let start = std::time::Instant::now();

let workdir = task.workdir.clone().unwrap_or(".".to_string());
let command = task.command.as_ref().unwrap();

println!("> Running command: '{}'", task.command.as_ref().unwrap());
let (command, args) = utils::split_head_from_rest(task.command.as_ref().unwrap());
let command_results = Command::new(command)
println!("> Running command: '{}'", command);
let command_results = Command::new("sh")
.current_dir(workdir)
.args(args)
.arg("-c")
.arg(command)
.status();

TaskResult {
Expand Down

0 comments on commit a6849f1

Please sign in to comment.