summaryrefslogtreecommitdiff
path: root/cli/args/config_file.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-07-20 10:36:14 -0400
committerGitHub <noreply@github.com>2022-07-20 10:36:14 -0400
commit73504d76b29eddc1a563e74bb379682e23347b3c (patch)
treec752f30e6adef9a1e2f3fd7a1c59e817a955ddb7 /cli/args/config_file.rs
parentcee3246edbe80c665d947398ced300c6ec3b8c9b (diff)
fix(task): resolve deno configuration file first from specified `--cwd` arg (#15257)
Diffstat (limited to 'cli/args/config_file.rs')
-rw-r--r--cli/args/config_file.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/args/config_file.rs b/cli/args/config_file.rs
index 48f77d009..8e6b151a6 100644
--- a/cli/args/config_file.rs
+++ b/cli/args/config_file.rs
@@ -2,6 +2,8 @@
use crate::args::ConfigFlag;
use crate::args::Flags;
+use crate::args::TaskFlags;
+use crate::fs_util;
use crate::fs_util::canonicalize_path;
use crate::fs_util::specifier_parent;
use crate::fs_util::specifier_to_file_path;
@@ -449,6 +451,18 @@ impl ConfigFile {
return Ok(Some(cf));
}
}
+ // attempt to resolve the config file from the task subcommand's
+ // `--cwd` when specified
+ if let crate::args::DenoSubcommand::Task(TaskFlags {
+ cwd: Some(path),
+ ..
+ }) = &flags.subcommand
+ {
+ let task_cwd = fs_util::canonicalize_path(&PathBuf::from(path))?;
+ if let Some(path) = Self::discover_from(&task_cwd, &mut checked)? {
+ return Ok(Some(path));
+ }
+ };
// From CWD walk up to root looking for deno.json or deno.jsonc
let cwd = std::env::current_dir()?;
Self::discover_from(&cwd, &mut checked)