Enter now requires a directory (#761)

This commit is contained in:
JT 2022-01-16 11:14:34 -05:00 committed by GitHub
parent 9b128b7a03
commit 283a615ecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)?;