nushell/crates/nu-command/src
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
..
bytes Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
charting Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
conversions use abbreviated string instead of debug string for DatetimeParseErrors (#12517) 2024-04-16 23:19:03 +02:00
database Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
date use abbreviated string instead of debug string for DatetimeParseErrors (#12517) 2024-04-16 23:19:03 +02:00
debug add ability to set metadata (#12564) 2024-04-19 09:03:59 +08:00
env Improve with-env robustness (#12523) 2024-04-16 19:08:58 +08:00
experimental Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
filesystem making ls and du supports rest parameters. (#12327) 2024-04-13 15:03:17 +00:00
filters Make group-by return errors in closure (#12508) 2024-04-16 21:52:21 +02:00
formats Add ListItem type for Expr::List (#12529) 2024-04-18 13:21:05 +02:00
generators Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
hash Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
help Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
math Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
misc Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
network Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
path Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
platform Return value instead of stream from kill (#12480) 2024-04-12 10:44:27 -05:00
random Range refactor (#12405) 2024-04-06 09:04:56 -05:00
removed Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
shells Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
stor Fix typo in help stor import (#12442) 2024-04-07 08:09:24 -05:00
strings use abbreviated string instead of debug string for DatetimeParseErrors (#12517) 2024-04-16 23:19:03 +02:00
system Fix circular source causing Nushell to crash (#12262) 2024-04-19 09:38:08 +03:00
viewers Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
default_context.rs add ability to set metadata (#12564) 2024-04-19 09:03:59 +08:00
example_test.rs Initial --params implementation (#12249) 2024-03-24 15:40:21 -05:00
lib.rs Initial --params implementation (#12249) 2024-03-24 15:40:21 -05:00
progress_bar.rs remove cp-old (#11622) 2024-01-24 07:38:15 +08:00
sort_utils.rs Rename Value::CustomValue to Value::Custom (#12309) 2024-03-27 22:10:56 +01:00