mirror of
https://github.com/nushell/nushell.git
synced 2024-11-23 00:43:33 +01:00
* Fixed printing of builtin kill command * Fixed fmt and clippy issues for kill command * Uncommented unintentional comments * Fixed wrong code added in kill command * Fixed more fmt issues with kill command
This commit is contained in:
parent
73f94105a5
commit
c5e7bccee5
@ -2,8 +2,8 @@ use nu_engine::CallExt;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{ast::Call, span};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Spanned, SyntaxShape,
|
||||
Value,
|
||||
Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError,
|
||||
Signature, Spanned, SyntaxShape, Value,
|
||||
};
|
||||
use std::process::{Command as CommandSys, Stdio};
|
||||
|
||||
@ -128,9 +128,22 @@ impl Command for Kill {
|
||||
.stderr(Stdio::null());
|
||||
}
|
||||
|
||||
cmd.status().expect("failed to execute shell command");
|
||||
|
||||
Ok(Value::Nothing { span: call.head }.into_pipeline_data())
|
||||
let output = cmd.output().expect("failed to execute shell command");
|
||||
let val = String::from(
|
||||
String::from_utf8(output.stdout)
|
||||
.expect("failed to convert output to string")
|
||||
.trim_end(),
|
||||
);
|
||||
if val.is_empty() {
|
||||
Ok(Value::Nothing { span: call.head }.into_pipeline_data())
|
||||
} else {
|
||||
Ok(vec![Value::String {
|
||||
val,
|
||||
span: call.head,
|
||||
}]
|
||||
.into_iter()
|
||||
.into_pipeline_data(engine_state.ctrlc.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
|
Loading…
Reference in New Issue
Block a user