-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loop { echo foo } doesn't work #7402
Comments
Veetaha
changed the title
loop with try catch inside skips catch block
loop/while with try catch inside skips catch block
Dec 9, 2022
UPD loop {
try {
^false
} catch { }
print "err"
} But it seems it is fixed now, however, the code in the issue doesn't work as expected |
Veetaha
changed the title
loop/while with try catch inside skips catch block
loop { "echo" } doesn't work
Dec 9, 2022
Veetaha
changed the title
loop { echo "foo" } doesn't work
loop { echo foo } doesn't work
Dec 9, 2022
sholderbach
added
the
semantics
Places where we should define/clarify nushell's semantics
label
Dec 9, 2022
sophiajt
pushed a commit
that referenced
this issue
Dec 11, 2022
# Description Fixes: #7404 Fixes: #7402 ## About change In `eval_block`, all pipelines(or called statements?) result will be printed except the last one, the last one is returned by `eval_block` function. So if we want to print the last statement in eval block, we just need to print that value. # User-Facing Changes ### for ``` ❯ for _ in 1..2 { echo "a" } a a ``` ### while ``` ❯ mut x = 1; while $x < 3 { $x = $x + 1; echo bb; } bb bb ``` ### loop ``` ❯ mut total = 0; loop { ∙ if $total > 1 { ∙ break ∙ } else { ∙ $total += 1 ∙ } ∙ echo 3 ∙ } 3 3 ``` # 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 # 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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Minimal reproduction.
How to reproduce
Run the script higher and you'll see that the program hangs as expected, but doesn't produce any output to the terminal.
Expected behavior
I expect to see the following output repeating forever:
Configuration
Also, this doesn't work
Additional Context
The problem also appears with
while true
:And it also appears with
for
:The text was updated successfully, but these errors were encountered: