Allow path join to read ByteStream input (#15128) (#15736)

# Description
Fixes #15128. Allows `path join` to use ByteStream pipeline data to join
on if it's coercible to string. Binary ByteStream input still results in
an error. Tested with `^$nu.current-exe -c '$nu.config-path' | path join
foo` and `^tar.exe -c assets/nu_logo.ico | path join foo`

# User-Facing Changes
If an external command returns a path, users would previously need to
use `^show-path-cmd | collect | path join 'foo'`, now they can drop the
intermediate `collect`.
This commit is contained in:
Firegem 2025-05-12 04:44:06 -04:00 committed by GitHub
parent 6a8c183c1a
commit 7d6d48f3f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -175,13 +175,11 @@ fn run(call: &Call, args: &Arguments, input: PipelineData) -> Result<PipelineDat
handle_value(stream.into_value(), args, head), handle_value(stream.into_value(), args, head),
metadata, metadata,
)), )),
PipelineData::ByteStream(stream, ..) => Ok(PipelineData::Value(
handle_value(stream.into_value()?, args, head),
metadata,
)),
PipelineData::Empty => Err(ShellError::PipelineEmpty { dst_span: head }), PipelineData::Empty => Err(ShellError::PipelineEmpty { dst_span: head }),
_ => Err(ShellError::UnsupportedInput {
msg: "Input value cannot be joined".to_string(),
input: "value originates from here".into(),
msg_span: head,
input_span: input.span().unwrap_or(call.head),
}),
} }
} }