mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 14:36:08 +02:00
throw an error instead of a panic if no input is provided to inspect
(#9259)
# Description This is a small PR to fix Nu crashing when calling `inspect` with no data piped in(#9255). # User-Facing Changes none.
This commit is contained in:
@ -34,6 +34,11 @@ impl Command for Inspect {
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let input_metadata = input.metadata();
|
||||
let input_val = input.into_value(call.head);
|
||||
if input_val.is_nothing() {
|
||||
return Err(ShellError::PipelineEmpty {
|
||||
dst_span: call.head,
|
||||
});
|
||||
}
|
||||
let original_input = input_val.clone();
|
||||
let description = match input_val {
|
||||
Value::CustomValue { ref val, .. } => val.value_string(),
|
||||
|
Reference in New Issue
Block a user