summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorMarvin Hagemeister <marvin@deno.com>2024-08-27 11:27:10 +0200
committerGitHub <noreply@github.com>2024-08-27 11:27:10 +0200
commit7e68cce8159d55fd597f0da3e00f794200b9928f (patch)
tree451cc7d0deb419afe74cf1dbfd52469bb53e19b6 /cli
parentb6dbe1e256948293fd95a11740f68da7361e652b (diff)
fix(task): support tasks with colons in name in `deno run` (#25233)
Fix task names containing a colon not being found with `deno run`. We were only checking for a `module not found` error message, but strings containing a colon throw a different error. Fixes https://github.com/denoland/deno/issues/25232
Diffstat (limited to 'cli')
-rw-r--r--cli/main.rs4
-rw-r--r--cli/standalone/mod.rs1
2 files changed, 4 insertions, 1 deletions
diff --git a/cli/main.rs b/cli/main.rs
index 290eee120..ee2bd79cc 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -53,6 +53,7 @@ use deno_runtime::tokio_util::create_and_run_current_thread_with_maybe_metrics;
use deno_terminal::colors;
use factory::CliFactory;
use standalone::MODULE_NOT_FOUND;
+use standalone::UNSUPPORTED_SCHEME;
use std::env;
use std::future::Future;
use std::ops::Deref;
@@ -196,7 +197,8 @@ async fn run_subcommand(flags: Arc<Flags>) -> Result<i32, AnyError> {
match result {
Ok(v) => Ok(v),
Err(script_err) => {
- if script_err.to_string().starts_with(MODULE_NOT_FOUND) {
+ let script_err_msg = script_err.to_string();
+ if script_err_msg.starts_with(MODULE_NOT_FOUND) || script_err_msg.starts_with(UNSUPPORTED_SCHEME) {
if run_flags.bare {
let mut cmd = args::clap_root();
cmd.build();
diff --git a/cli/standalone/mod.rs b/cli/standalone/mod.rs
index 68e133476..90b2b8a28 100644
--- a/cli/standalone/mod.rs
+++ b/cli/standalone/mod.rs
@@ -133,6 +133,7 @@ struct EmbeddedModuleLoader {
}
pub const MODULE_NOT_FOUND: &str = "Module not found";
+pub const UNSUPPORTED_SCHEME: &str = "Unsupported scheme";
impl ModuleLoader for EmbeddedModuleLoader {
fn resolve(