diff --git a/crates/shell/src/main.rs b/crates/shell/src/main.rs index 8d8ffdd..0ba916a 100644 --- a/crates/shell/src/main.rs +++ b/crates/shell/src/main.rs @@ -21,15 +21,24 @@ fn commands() -> HashMap> { } async fn execute(text: &str, state: &mut ShellState) -> anyhow::Result { - let list = deno_task_shell::parser::parse(text)?; + let list = deno_task_shell::parser::parse(text); + + let mut stderr = ShellPipeWriter::stderr(); + let stdout = ShellPipeWriter::stdout(); + let stdin = ShellPipeReader::stdin(); + + if let Err(e) = list { + let _ = stderr.write_line(&format!("Syntax error: {}", e)); + return Ok(1); + } // spawn a sequential list and pipe its output to the environment let result = execute_sequential_list( - list, + list.unwrap(), state.clone(), - ShellPipeReader::stdin(), - ShellPipeWriter::stdout(), - ShellPipeWriter::stderr(), + stdin, + stdout, + stderr, AsyncCommandBehavior::Wait, ) .await;