Remove stdout_read_limit param from exec_process_in_job

This can always be trivially fetched from the parser - no need to pass it
in separately.
This commit is contained in:
ridiculousfish 2020-07-28 15:27:40 -07:00
parent b259fe17f9
commit e4b1fc9f6a

View file

@ -710,7 +710,7 @@ static bool exec_block_or_func_process(parser_t &parser, const std::shared_ptr<j
static bool exec_process_in_job(parser_t &parser, process_t *p, const std::shared_ptr<job_t> &j, static bool exec_process_in_job(parser_t &parser, process_t *p, const std::shared_ptr<job_t> &j,
const io_chain_t &block_io, autoclose_pipes_t pipes, const io_chain_t &block_io, autoclose_pipes_t pipes,
const fd_set_t &conflicts, const autoclose_pipes_t &deferred_pipes, const fd_set_t &conflicts, const autoclose_pipes_t &deferred_pipes,
size_t stdout_read_limit, bool is_deferred_run = false) { bool is_deferred_run = false) {
// The write pipe (destined for stdout) needs to occur before redirections. For example, // The write pipe (destined for stdout) needs to occur before redirections. For example,
// with a redirection like this: // with a redirection like this:
// //
@ -818,7 +818,7 @@ static bool exec_process_in_job(parser_t &parser, process_t *p, const std::share
} }
case process_type_t::builtin: { case process_type_t::builtin: {
io_streams_t builtin_io_streams{stdout_read_limit}; io_streams_t builtin_io_streams{parser.libdata().read_limit};
builtin_io_streams.job_group = j->group; builtin_io_streams.job_group = j->group;
if (!exec_internal_builtin_proc(parser, p, pipe_read.get(), process_net_io_chain, if (!exec_internal_builtin_proc(parser, p, pipe_read.get(), process_net_io_chain,
builtin_io_streams)) { builtin_io_streams)) {
@ -906,8 +906,6 @@ bool exec_job(parser_t &parser, const shared_ptr<job_t> &j, const io_chain_t &bl
return true; return true;
} }
const size_t stdout_read_limit = parser.libdata().read_limit;
// Get the list of all FDs so we can ensure our pipes do not conflict. // Get the list of all FDs so we can ensure our pipes do not conflict.
fd_set_t conflicts = block_io.fd_set(); fd_set_t conflicts = block_io.fd_set();
for (const auto &p : j->processes) { for (const auto &p : j->processes) {
@ -973,7 +971,7 @@ bool exec_job(parser_t &parser, const shared_ptr<job_t> &j, const io_chain_t &bl
deferred_pipes = std::move(proc_pipes); deferred_pipes = std::move(proc_pipes);
} else { } else {
if (!exec_process_in_job(parser, p.get(), j, block_io, std::move(proc_pipes), conflicts, if (!exec_process_in_job(parser, p.get(), j, block_io, std::move(proc_pipes), conflicts,
deferred_pipes, stdout_read_limit)) { deferred_pipes)) {
exec_error = true; exec_error = true;
break; break;
} }
@ -985,7 +983,7 @@ bool exec_job(parser_t &parser, const shared_ptr<job_t> &j, const io_chain_t &bl
if (!exec_error && deferred_process) { if (!exec_error && deferred_process) {
assert(deferred_pipes.write.valid() && "Deferred process should always have a write pipe"); assert(deferred_pipes.write.valid() && "Deferred process should always have a write pipe");
if (!exec_process_in_job(parser, deferred_process, j, block_io, std::move(deferred_pipes), if (!exec_process_in_job(parser, deferred_process, j, block_io, std::move(deferred_pipes),
conflicts, {}, stdout_read_limit, true)) { conflicts, {}, true)) {
exec_error = true; exec_error = true;
} }
} }