forked from extern/nushell
Adds error printing back in a couple places (#5400)
This commit is contained in:
parent
92785ab92c
commit
14c9bd44ef
@ -5,8 +5,8 @@ use std::{
|
||||
|
||||
use crate::{
|
||||
ast::{Call, PathMember},
|
||||
engine::{EngineState, Stack},
|
||||
Config, ListStream, RawStream, ShellError, Span, Value,
|
||||
engine::{EngineState, Stack, StateWorkingSet},
|
||||
format_error, Config, ListStream, RawStream, ShellError, Span, Value,
|
||||
};
|
||||
|
||||
/// The foundational abstraction for input and output to commands
|
||||
@ -455,7 +455,15 @@ impl PipelineData {
|
||||
|
||||
for item in table {
|
||||
let stdout = std::io::stdout();
|
||||
let mut out = item.into_string("\n", config);
|
||||
|
||||
let mut out = if let Value::Error { error } = item {
|
||||
let working_set = StateWorkingSet::new(engine_state);
|
||||
|
||||
format_error(&working_set, &error)
|
||||
} else {
|
||||
item.into_string("\n", config)
|
||||
};
|
||||
|
||||
out.push('\n');
|
||||
|
||||
match stdout.lock().write_all(out.as_bytes()) {
|
||||
@ -467,7 +475,13 @@ impl PipelineData {
|
||||
None => {
|
||||
for item in self {
|
||||
let stdout = std::io::stdout();
|
||||
let mut out = item.into_string("\n", config);
|
||||
let mut out = if let Value::Error { error } = item {
|
||||
let working_set = StateWorkingSet::new(engine_state);
|
||||
|
||||
format_error(&working_set, &error)
|
||||
} else {
|
||||
item.into_string("\n", config)
|
||||
};
|
||||
out.push('\n');
|
||||
|
||||
match stdout.lock().write_all(out.as_bytes()) {
|
||||
|
Loading…
Reference in New Issue
Block a user