nushell/crates/nu-command/src/system
YizhePKU 6d2cb4382a
Fix circular source causing Nushell to crash (#12262)
# Description

EngineState now tracks the script currently running, instead of the
parent directory of the script. This also provides an easy way to expose
the current running script to the user (Issue #12195).

Similarly, StateWorkingSet now tracks scripts instead of directories.
`parsed_module_files` and `currently_parsed_pwd` are merged into one
variable, `scripts`, which acts like a stack for tracking the current
running script (which is on the top of the stack).

Circular import check is added for `source` operations, in addition to
module import. A simple testcase is added for circular source.

<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx

you can also mention related issues, PRs or discussions!
-->


<!--
Thank you for improving Nushell. Please, check our [contributing
guide](../CONTRIBUTING.md) and talk to the core team before making major
changes.

Description of your pull request goes here. **Provide examples and/or
screenshots** if your changes affect the user experience.
-->

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

It shouldn't have any user facing changes.
2024-04-19 09:38:08 +03:00
..
complete.rs Rename IoStream to OutDest (#12433) 2024-04-09 16:48:32 +00:00
exec.rs Rename IoStream to OutDest (#12433) 2024-04-09 16:48:32 +00:00
mod.rs Initial implementation for uutils uname (#11684) 2024-03-25 16:51:50 -05:00
nu_check.rs Fix circular source causing Nushell to crash (#12262) 2024-04-19 09:38:08 +03:00
ps.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
registry_query.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
run_external.rs Rename IoStream to OutDest (#12433) 2024-04-09 16:48:32 +00:00
sys.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
uname.rs cleanup coreutils tagging (#12286) 2024-03-25 17:13:46 -05:00
which_.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00