mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
Support binary data to stdin of run-external (#4984)
* Add test for passing binary data through externals This change adds an ignored test to confirm that binary data is passed correctly between externals to be enabled in a later commit along with the fix. To assist in platform agnostic testing of binary data a couple of additional testbins were added to allow testing on `Value::Binary` inside `ExternalStream`. * Support binary data to stdin of run-external Prior to this change, any pipeline producing binary data (not detected as string) then feed into an external would be ignored due to run-external only supporting `Value::String` on stdin. This change adds binary stdin support for externals allowing something like this for example: 〉^cat /dev/urandom | ^head -c 1MiB | ^pv -b | ignore 1.00MiB This would previously output `0.00 B [0.00 B/s]` due to the data not being pushed to stdin at each stage.
This commit is contained in:
@ -97,6 +97,16 @@ fn redirects_custom_command_external() {
|
||||
assert_eq!(actual.out, "8");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn passes_binary_data_between_externals() {
|
||||
let actual = nu!(cwd: "tests/fixtures/formats", r#"nu --testbin meowb sample.db | nu --testbin relay | hash sha256"#);
|
||||
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
"2f5050e7eea415c1f3d80b5d93355efd15043ec9157a2bb167a9e73f2ae651f2"
|
||||
)
|
||||
}
|
||||
|
||||
mod it_evaluation {
|
||||
use super::nu;
|
||||
use nu_test_support::fs::Stub::{EmptyFile, FileWithContent, FileWithContentToBeTrimmed};
|
||||
|
Reference in New Issue
Block a user