mirror of
https://github.com/nushell/nushell.git
synced 2024-11-25 01:43:47 +01:00
Return value instead of stream from kill
(#12480)
# Description The `kill` command returns a stream with a single value. This PR changes it to simply return the value. # User-Facing Changes Technically a breaking change.
This commit is contained in:
parent
3eb9c2a565
commit
741e3c3d8f
@ -147,23 +147,21 @@ impl Command for Kill {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let val = String::from(
|
let mut output =
|
||||||
String::from_utf8(output.stdout)
|
String::from_utf8(output.stdout).map_err(|e| ShellError::GenericError {
|
||||||
.map_err(|e| ShellError::GenericError {
|
error: "failed to convert output to string".into(),
|
||||||
error: "failed to convert output to string".into(),
|
msg: e.to_string(),
|
||||||
msg: e.to_string(),
|
span: Some(call.head),
|
||||||
span: Some(call.head),
|
help: None,
|
||||||
help: None,
|
inner: vec![],
|
||||||
inner: vec![],
|
})?;
|
||||||
})?
|
|
||||||
.trim_end(),
|
output.truncate(output.trim_end().len());
|
||||||
);
|
|
||||||
if val.is_empty() {
|
if output.is_empty() {
|
||||||
Ok(Value::nothing(call.head).into_pipeline_data())
|
Ok(Value::nothing(call.head).into_pipeline_data())
|
||||||
} else {
|
} else {
|
||||||
Ok(vec![Value::string(val, call.head)]
|
Ok(Value::string(output, call.head).into_pipeline_data())
|
||||||
.into_iter()
|
|
||||||
.into_pipeline_data(engine_state.ctrlc.clone()))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user