forked from extern/nushell
260ff99710
* feat: spawn the executables directly if possible This pull request changes nu-command so that it spawns the process directly if: - They are a `.exe` on Windows - They are not a `.sh` or `.bash` on not windows. Benefits: - As I explained in [this comment](https://github.com/nushell/nushell/issues/3898#issuecomment-894000812), this is another step towards making Nushell a standalone shell, that doesn't need to shell out unless it is running a script for a particular shell (cmd, sh, ps1, etc.). - Fixes the bug with multiline strings - Better performance due to direct spawning. For example, this script shows ~20 ms less latency. After: ```nu C:\> benchmark { node -e 'console.log("sssss")' } ───┬────────────────── # │ real time ───┼────────────────── 0 │ 63ms 921us 600ns ───┴────────────────── ``` Before ```nu C:\> benchmark { node -e 'console.log("sssss")' } ───┬────────────────── # │ real time ───┼────────────────── 0 │ 79ms 136us 800ns ───┴────────────────── ``` Fixes #3898 * fix: make which dependency optional Also fixes clippy warnings * refactor: refactor spawn_exe, spawn_cmd, spawn_sh, and spawn_any * fix: use which feature instead of which-support * fix: use which_in to use the cwd of nu * fix: use case insensitive comparison of the extensions Sometimes the case of the extension is uppercased by the "which_in" function Also use unix instead of not windows. Some os might not have sh support |
||
---|---|---|
.. | ||
assets | ||
src | ||
tests | ||
build.rs | ||
Cargo.toml | ||
README.md |
nu-command
The Nu command crate contains the full set of internal commands, that is, the commands that can be form the set of built-in commands in a Nushell engine.
The default set of commands that Nushell ships with can be found in the default context.
The commands themselves live in the commands module.