mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 04:45:04 +02:00
Stream lazy default
output (#15955)
It was brought up in the Discord that `default { open -r foo.txt }`
results in a string instead of streaming output. This changes `default`
such that closures now stream when given simple input.
# Description
If the value isn't expected to be cached, `default` just runs the
closure without caching the value, which allows its output to be
streamed
# User-Facing Changes
# Tests + Formatting
👍
# After Submitting
This commit is contained in:
@ -244,3 +244,9 @@ fn return_closure_value() {
|
||||
let actual = nu!(r#"null | default { {||} }"#);
|
||||
assert!(actual.out.starts_with("closure"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lazy_output_streams() {
|
||||
let actual = nu!(r#"default { nu --testbin cococo 'hello' } | describe"#);
|
||||
assert!(actual.out.contains("byte stream"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user