Throw out error if external command in subexpression is failed to run#8204
Conversation
|
Nice PR, thanks! This is an improvement, but the result of the subexpression is surprising to me: 〉let f = (^false; "foo")
〉$f
〉$f | describe
string
〉(^false;"hello,world!") | describe
stringI'm not 100% sure what the desired behaviour is here, but returning an empty string seems wrong. |
|
Hmm...Or the variable shouldn't defined? And I'm not sure how it breaks test code, need to take a deeper look |
|
Hi, refer to let assignment, sorry I don't have a perfect way.... Currently I have two options:
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8204 +/- ##
==========================================
+ Coverage 67.72% 68.09% +0.37%
==========================================
Files 621 620 -1
Lines 99312 99313 +1
==========================================
+ Hits 67258 67629 +371
+ Misses 32054 31684 -370
|
|
I prefer 1. I think |
|
Yeah, I like 1 too, and I've update title and descripiton to reflect latest changes |
|
Great the tests are working now! One question: What value will be stored in |
|
In this case x will remain undefined |
|
Yeah, this is interesting, because parser still has the |
…d to run (nushell#8204)" This reverts commit dec0a25.
…d to run (#8204)" (#8475) This reverts commit dec0a25. It breaks programs like `fzf` # Description Fixes: #8472 Fixes: #8313 Reopen: #7690 # User-Facing Changes _(List of all changes that impact the user experience here. This helps us keep track of breaking changes.)_ # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date.
…d to run (#8204)" (#8475) This reverts commit dec0a25. It breaks programs like `fzf` # Description Fixes: #8472 Fixes: #8313 Reopen: #7690 # User-Facing Changes _(List of all changes that impact the user experience here. This helps us keep track of breaking changes.)_ # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date.
Description
Fixes: #7690
User-Facing Changes
The following command:
As we can see, it will throws out error rather than return "foo".
I think it's fine, because the semantic of subexpression is eval a subexpression to a value, if the external command is failed to run, it means that we can't convert the result to value.
It's different to
^cat asdf, which runs the command directlry.Tests + Formatting
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
cargo fmt --all -- --checkto check standard code formatting (cargo fmt --allapplies these changes)cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collectto check that you're using the standard code stylecargo test --workspaceto check that all tests passAfter Submitting
If your PR had any user-facing changes, update the documentation after the PR is merged, if necessary. This will help us keep the docs up to date.