mirror of
https://github.com/nushell/nushell.git
synced 2025-01-12 17:28:13 +01:00
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::{
|
use crate::{
|
||||||
ast::{Call, PathMember},
|
ast::{Call, PathMember},
|
||||||
engine::{EngineState, Stack},
|
engine::{EngineState, Stack, StateWorkingSet},
|
||||||
Config, ListStream, RawStream, ShellError, Span, Value,
|
format_error, Config, ListStream, RawStream, ShellError, Span, Value,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The foundational abstraction for input and output to commands
|
/// The foundational abstraction for input and output to commands
|
||||||
@ -455,7 +455,15 @@ impl PipelineData {
|
|||||||
|
|
||||||
for item in table {
|
for item in table {
|
||||||
let stdout = std::io::stdout();
|
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');
|
out.push('\n');
|
||||||
|
|
||||||
match stdout.lock().write_all(out.as_bytes()) {
|
match stdout.lock().write_all(out.as_bytes()) {
|
||||||
@ -467,7 +475,13 @@ impl PipelineData {
|
|||||||
None => {
|
None => {
|
||||||
for item in self {
|
for item in self {
|
||||||
let stdout = std::io::stdout();
|
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');
|
out.push('\n');
|
||||||
|
|
||||||
match stdout.lock().write_all(out.as_bytes()) {
|
match stdout.lock().write_all(out.as_bytes()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user