mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
Fix PipelineData::print when table
is overridden (#6129)
* Fix PipelineData::print when `table` is overridden Fixes #6113 Signed-off-by: nibon7 <nibon7@163.com> * don't use deprecated `is_custom_command` Signed-off-by: nibon7 <nibon7@163.com> * add test Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
parent
e4e27b6e11
commit
72c27bd095
2 changed files with 11 additions and 6 deletions
|
@ -460,12 +460,12 @@ impl PipelineData {
|
||||||
|
|
||||||
match engine_state.find_decl("table".as_bytes(), &[]) {
|
match engine_state.find_decl("table".as_bytes(), &[]) {
|
||||||
Some(decl_id) => {
|
Some(decl_id) => {
|
||||||
let table = engine_state.get_decl(decl_id).run(
|
let command = engine_state.get_decl(decl_id);
|
||||||
engine_state,
|
if command.get_block_id().is_some() {
|
||||||
stack,
|
return self.write_all_and_flush(engine_state, config, no_newline, to_stderr);
|
||||||
&Call::new(Span::new(0, 0)),
|
}
|
||||||
self,
|
|
||||||
)?;
|
let table = command.run(engine_state, stack, &Call::new(Span::new(0, 0)), self)?;
|
||||||
|
|
||||||
table.write_all_and_flush(engine_state, config, no_newline, to_stderr)?;
|
table.write_all_and_flush(engine_state, config, no_newline, to_stderr)?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,3 +130,8 @@ fn help_not_present_in_extern() -> TestResult {
|
||||||
"Usage:\n > git fetch",
|
"Usage:\n > git fetch",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn override_table() -> TestResult {
|
||||||
|
run_test(r#"def table [] { "hi" }; table"#, "hi")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue