Arrange to store captured output after wait and poll, besides after foreground statement.

This commit is contained in:
Gene Stark 2022-04-11 10:42:58 -04:00
parent 8ca7e77e25
commit b74ac13807
2 changed files with 8 additions and 1 deletions

Binary file not shown.

View File

@ -227,6 +227,9 @@ int exec_stmt(STMT *stmt) {
int job = eval_to_numeric(stmt->members.jobctl_stmt.expr); int job = eval_to_numeric(stmt->members.jobctl_stmt.expr);
int status = jobs_wait(job); int status = jobs_wait(job);
store_set_int(STATUS_VAR, status); store_set_int(STATUS_VAR, status);
char *output = jobs_get_output(job);
if(output)
store_set_string(OUTPUT_VAR, output);
jobs_expunge(job); jobs_expunge(job);
} }
break; break;
@ -235,8 +238,12 @@ int exec_stmt(STMT *stmt) {
int job = eval_to_numeric(stmt->members.jobctl_stmt.expr); int job = eval_to_numeric(stmt->members.jobctl_stmt.expr);
int status = jobs_poll(job); int status = jobs_poll(job);
store_set_int(STATUS_VAR, status); store_set_int(STATUS_VAR, status);
if(status >= 0) if(status >= 0) {
char *output = jobs_get_output(job);
if(output)
store_set_string(OUTPUT_VAR, output);
jobs_expunge(job); jobs_expunge(job);
}
} }
break; break;
case CANCEL_STMT_CLASS: case CANCEL_STMT_CLASS: