mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-28 13:11:15 -03:00
Do not buffer builtin output if avoidable
builtins output to stdout and stderr via io_streams_t. Prior to this fix, it contained an output_stream_t which just wraps a buffer. So all builtin output went to this buffer (except for eval). Switch output_stream_t to become a new abstract class which can output to a buffer, file descriptor, or nowhere. This allows for example `string` to stream its output as it is produced, instead of buffering it.
This commit is contained in:
@@ -388,11 +388,14 @@ end_execution_reason_t parse_execution_context_t::run_function_statement(
|
||||
return result;
|
||||
}
|
||||
trace_if_enabled(*parser, L"function", arguments);
|
||||
io_streams_t streams(0); // no limit on the amount of output from builtin_function()
|
||||
// no limit on the amount of output from builtin_function()
|
||||
buffered_output_stream_t outs(0);
|
||||
buffered_output_stream_t errs(0);
|
||||
io_streams_t streams(outs, errs);
|
||||
int err = builtin_function(*parser, streams, arguments, pstree, statement);
|
||||
parser->set_last_statuses(statuses_t::just(err));
|
||||
|
||||
wcstring errtext = streams.err.contents();
|
||||
wcstring errtext = errs.contents();
|
||||
if (!errtext.empty()) {
|
||||
return this->report_error(err, header, L"%ls", errtext.c_str());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user