From 283a615eccd9bfc0d82c2b50a1d083cbb1def514 Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Sun, 16 Jan 2022 11:14:34 -0500 Subject: [PATCH] Enter now requires a directory (#761) --- crates/nu-command/src/shells/enter.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/nu-command/src/shells/enter.rs b/crates/nu-command/src/shells/enter.rs index 2840c66e8..2a586c710 100644 --- a/crates/nu-command/src/shells/enter.rs +++ b/crates/nu-command/src/shells/enter.rs @@ -41,6 +41,13 @@ impl Command for Enter { return Err(ShellError::DirectoryNotFound(path_span)); } + if !new_path.is_dir() { + return Err(ShellError::DirectoryNotFoundCustom( + "not a directory".to_string(), + path_span, + )); + } + let cwd = current_dir(engine_state, stack)?; let new_path = nu_path::canonicalize_with(new_path, &cwd)?;