mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 00:13:21 +01:00
Update cwd as we cd
This commit is contained in:
parent
1c44de4bba
commit
fdc5e802eb
@ -1,6 +1,7 @@
|
|||||||
use crate::errors::ShellError;
|
use crate::errors::ShellError;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use derive_new::new;
|
use derive_new::new;
|
||||||
|
use std::env;
|
||||||
|
|
||||||
#[derive(new)]
|
#[derive(new)]
|
||||||
pub struct Cd;
|
pub struct Cd;
|
||||||
@ -17,6 +18,7 @@ impl crate::Command for Cd {
|
|||||||
|
|
||||||
let mut stream = VecDeque::new();
|
let mut stream = VecDeque::new();
|
||||||
let path = dunce::canonicalize(cwd.join(&target).as_path())?;
|
let path = dunce::canonicalize(cwd.join(&target).as_path())?;
|
||||||
|
let _ = env::set_current_dir(&path);
|
||||||
stream.push_back(ReturnValue::change_cwd(path));
|
stream.push_back(ReturnValue::change_cwd(path));
|
||||||
Ok(stream)
|
Ok(stream)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user