Skip to content

Commit

Permalink
fix: print arguments given to a pixi task (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-arts authored Dec 6, 2023
1 parent 2ebcecb commit cb441b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub fn order_tasks(
Ok(s2)
}

pub async fn create_script(task: &Task, args: Vec<String>) -> miette::Result<SequentialList> {
pub async fn create_script(task: &Task, args: &[String]) -> miette::Result<SequentialList> {
// Construct the script from the task
let task = task
.as_single_command()
Expand Down Expand Up @@ -229,20 +229,21 @@ pub async fn execute(args: Args) -> miette::Result<()> {
// which is fine when using run in isolation, however if we start to use run in conjunction with
// some other command we might want to revaluate this.
let ctrl_c = tokio::spawn(async { while tokio::signal::ctrl_c().await.is_ok() {} });
let script = create_script(&command, arguments).await?;
let script = create_script(&command, &arguments).await?;

// Showing which command is being run if the level and type allows it.
if tracing::enabled!(Level::WARN) && !matches!(command, Task::Custom(_)) {
eprintln!(
"{}{}",
"{}{} {}",
console::style("✨ Pixi task: ").bold(),
console::style(
&command
.as_single_command()
.expect("The command should already be parsed")
)
.blue()
.bold()
.bold(),
console::style(arguments.join(" ")).blue(),
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl PixiControl {
let mut result = RunOutput::default();
while let Some((command, args)) = tasks.pop_back() {
let cwd = run::select_cwd(command.working_directory(), &project)?;
let script = create_script(&command, args).await;
let script = create_script(&command, &args).await;
if let Ok(script) = script {
let output =
execute_script_with_output(script, cwd.as_path(), &task_env, None).await;
Expand Down

0 comments on commit cb441b1

Please sign in to comment.