diff --git a/README.md b/README.md index cdc1a8e165e9b156dbe6d7af70bb87224746603b..07304fa107eb6210ea027a675d40f04c2d091840 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ +# Introduction + +Ion is a modern system shell that features a simple, yet powerful, syntax. It is written entirely +in Rust, which greatly increases the overall quality and security of the shell, eliminating the +possibilities of a [ShellShock](http://www.wikiwand.com/en/Shellshock_(software_bug))-like vulnerability +, and making development easier. It also offers a level of performance that exceeds that of Dash, +when taking advantage of Ion's features. While it is developed alongside, and primarily for, RedoxOS, +it is a fully capable on other \*nix platforms. + # Ion Shell [](https://travis-ci.org/redox-os/ion) @@ -74,15 +83,6 @@ In addition to the chatroom, there's a [thread in the Redox forums](https://disc that can be used for discussions relating to Ion and Ion shell development. These are mostly served by the GitHub issue board, but general discussions can take place there instead. -# Introduction - -Ion is a modern system shell that features a simple, yet powerful, syntax. It is written entirely -in Rust, which greatly increases the overall quality and security of the shell, eliminating the -possibilities of a [ShellShock](http://www.wikiwand.com/en/Shellshock_(software_bug))-like vulnerability -, and making development easier. It also offers a level of performance that exceeds that of Dash, -when taking advantage of Ion's features. While it is developed alongside, and primarily for, RedoxOS, -it is a fully capable on other \*nix platforms. - ## Why Not Windows Support? Windows is not, and may never be supported due to certain limitations in the NT kernel. Namely, diff --git a/src/lib/builtins/mod.rs b/src/lib/builtins/mod.rs index a81181d60a53305257abb9154dd166b74363850e..0ef1f897d2877ea2be2d024904e158c28c26edf8 100644 --- a/src/lib/builtins/mod.rs +++ b/src/lib/builtins/mod.rs @@ -243,7 +243,7 @@ fn builtin_pushd(args: &[&str], shell: &mut Shell) -> i32 { if check_help(args, MAN_PUSHD) { return SUCCESS; } - match shell.directory_stack.pushd(args, &shell.variables) { + match shell.directory_stack.pushd(args, &mut shell.variables) { Ok(()) => SUCCESS, Err(why) => { let stderr = io::stderr(); @@ -258,8 +258,7 @@ fn builtin_popd(args: &[&str], shell: &mut Shell) -> i32 { if check_help(args, MAN_POPD) { return SUCCESS; } - - match shell.directory_stack.popd(args) { + match shell.directory_stack.popd(args, &mut shell.variables) { Ok(()) => SUCCESS, Err(why) => { let stderr = io::stderr(); diff --git a/src/lib/shell/directory_stack.rs b/src/lib/shell/directory_stack.rs index bda81db543763ad86bcd17eceedc1acb7e7913bd..daa17c0b16317ba0fd48e51b28a8f530cdb1bf31 100644 --- a/src/lib/shell/directory_stack.rs +++ b/src/lib/shell/directory_stack.rs @@ -40,7 +40,7 @@ impl DirectoryStack { /// Attempts to set the current directory to the directory stack's previous directory, /// and then removes the front directory from the stack. - pub(crate) fn popd<I: IntoIterator>(&mut self, args: I) -> Result<(), Cow<'static, str>> + pub(crate) fn popd<I: IntoIterator>(&mut self, args: I, variables: &mut Variables) -> Result<(), Cow<'static, str>> where I::Item: AsRef<str>, { @@ -101,6 +101,8 @@ impl DirectoryStack { ))); } + // Manually update $PWD + variables.set_var("PWD", current_dir().unwrap().to_str().unwrap()); self.print_dirs(); Ok(()) } @@ -108,7 +110,7 @@ impl DirectoryStack { pub(crate) fn pushd<I: IntoIterator>( &mut self, args: I, - variables: &Variables, + variables: &mut Variables, ) -> Result<(), Cow<'static, str>> where I::Item: AsRef<str>, @@ -164,8 +166,9 @@ impl DirectoryStack { } }; + // Manually update $PWD + variables.set_var("PWD", current_dir().unwrap().to_str().unwrap()); self.print_dirs(); - Ok(()) }