mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 07:05:47 +02:00
Fixes how environment is cloned inside tight loops (#678)
* Improve cd IO error * Fix environment cloning in loops * Remove debug print * Fmt
This commit is contained in:
@ -47,11 +47,12 @@ impl Stack {
|
||||
}
|
||||
|
||||
pub fn with_env(&mut self, env_vars: &[HashMap<String, Value>], env_hidden: &HashSet<String>) {
|
||||
if env_vars.iter().any(|scope| !scope.is_empty()) {
|
||||
// Do not clone the environment if it hasn't changed
|
||||
if self.env_vars.iter().any(|scope| !scope.is_empty()) {
|
||||
self.env_vars = env_vars.to_owned();
|
||||
}
|
||||
|
||||
if !env_hidden.is_empty() {
|
||||
if !self.env_hidden.is_empty() {
|
||||
self.env_hidden = env_hidden.clone();
|
||||
}
|
||||
}
|
||||
|
@ -189,10 +189,14 @@ pub enum ShellError {
|
||||
#[diagnostic(code(nu::shell::directory_not_found), url(docsrs))]
|
||||
DirectoryNotFound(#[label("directory not found")] Span),
|
||||
|
||||
#[error("File not found")]
|
||||
#[diagnostic(code(nu::shell::file_not_found), url(docsrs))]
|
||||
#[error("Directory not found")]
|
||||
#[diagnostic(code(nu::shell::directory_not_found_custom), url(docsrs))]
|
||||
DirectoryNotFoundCustom(String, #[label("{0}")] Span),
|
||||
|
||||
#[error("Directory not found")]
|
||||
#[diagnostic(code(nu::shell::directory_not_found_help), url(docsrs), help("{1}"))]
|
||||
DirectoryNotFoundHelp(#[label("directory not found")] Span, String),
|
||||
|
||||
#[error("Move not possible")]
|
||||
#[diagnostic(code(nu::shell::move_not_possible), url(docsrs))]
|
||||
MoveNotPossible {
|
||||
|
Reference in New Issue
Block a user