~emersion/mrsh

24431923479f397481fb6bc40ded5224aa57e8e7 — Simon Ser 1 year, 1 month ago bae66ff
builtin/fg: move background jobs, not stopped jobs

From the POSIX spec:

> the fg utility shall move a background job from the current environment into
> the foreground
1 files changed, 1 insertions(+), 1 deletions(-)

M builtin/fg.c
M builtin/fg.c => builtin/fg.c +1 -1
@@ 27,7 27,7 @@ int builtin_fg(struct mrsh_state *state, int argc, char *argv[]) {
	struct mrsh_job *stopped = NULL;
	for (ssize_t i = state->jobs.len - 1; i >= 0; --i) {
		struct mrsh_job *job = state->jobs.data[i];
		if (job_stopped(job)) {
		if (job != state->foreground_job) {
			stopped = job;
			break;
		}