1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

feat(task): add unstable warning to deno task (#13966)

This commit is contained in:
David Sherret 2022-03-15 21:24:07 -04:00 committed by GitHub
parent a7bef54d3f
commit 748aff1e94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 7 deletions

4
Cargo.lock generated
View file

@ -1079,9 +1079,9 @@ dependencies = [
[[package]]
name = "deno_task_shell"
version = "0.1.8"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fafb65c387677c45078adb3bb70503128cadd0ee94772167be4f7da8549434dc"
checksum = "b4b477c481d76502130fc5a212900fbe9da9520ad65c54c7e6a7cb129df082fb"
dependencies = [
"anyhow",
"futures",

View file

@ -41,7 +41,7 @@ deno_doc = "0.32.0"
deno_graph = "0.24.0"
deno_lint = { version = "0.26.0", features = ["docs"] }
deno_runtime = { version = "0.48.0", path = "../runtime" }
deno_task_shell = "0.1.8"
deno_task_shell = "0.1.9"
atty = "=0.2.14"
base64 = "=0.13.0"

View file

@ -25,7 +25,7 @@ itest!(task_boolean_logic {
envs: vec![("NO_COLOR".to_string(), "1".to_string())],
});
itest!(task_exit_code_1 {
itest!(task_exit_code_5 {
args: "task --config task/deno.json exit_code_5",
output: "task/task_exit_code_5.out",
envs: vec![("NO_COLOR".to_string(), "1".to_string())],

View file

@ -1,2 +1,3 @@
Task exit_code_5 echo $(echo 10 ; exit 2) && exit 5
Warning deno task is unstable and may drastically change in the future
Task exit_code_5 echo $(echo 10 ; exit 2) && exit 5
10

View file

@ -1,3 +1,4 @@
Warning deno task is unstable and may drastically change in the future
Task not found: non_existent
Available tasks:
- boolean_logic

View file

@ -52,6 +52,10 @@ pub async fn execute_script(
flags: Flags,
task_flags: TaskFlags,
) -> Result<i32, AnyError> {
log::warn!(
"{} deno task is unstable and may drastically change in the future",
crate::colors::yellow("Warning"),
);
let flags = Arc::new(flags);
let ps = ProcState::build(flags.clone()).await?;
let tasks_config = get_tasks_config(ps.maybe_config_file.as_ref())?;
@ -81,13 +85,14 @@ pub async fn execute_script(
.collect::<Vec<_>>()
.join(" ");
let script = format!("{} {}", script, additional_args);
let script = script.trim();
log::info!(
"{} {} {}",
colors::green("Task"),
colors::cyan(&task_name),
script
script,
);
let seq_list = deno_task_shell::parser::parse(&script)
let seq_list = deno_task_shell::parser::parse(script)
.with_context(|| format!("Error parsing script '{}'.", task_name))?;
let env_vars = std::env::vars().collect::<HashMap<String, String>>();
let exit_code = deno_task_shell::execute(seq_list, env_vars, cwd).await;