Add a $status_generation variable that's incremented for each interactive command that produces a status.

This can be used to determine whether the previous command produced a real status, or just carried over the status from the command before it. Backgrounded commands and variable assignments will not increment status_generation, all other commands will.
This commit is contained in:
Soumya
2020-08-02 13:37:19 -07:00
committed by ridiculousfish
parent 54823c9243
commit a2b2bcef6e
10 changed files with 140 additions and 7 deletions

View File

@@ -393,6 +393,7 @@ end_execution_reason_t parse_execution_context_t::run_function_statement(
buffered_output_stream_t errs(0);
io_streams_t streams(outs, errs);
int err = builtin_function(*parser, streams, arguments, pstree, statement);
parser->libdata().status_count++;
parser->set_last_statuses(statuses_t::just(err));
wcstring errtext = errs.contents();