From fcc214e207cf4142529ac565f9b18671b17e6bcb Mon Sep 17 00:00:00 2001 From: "[GPL]Ed" Date: Fri, 7 Jul 2023 10:55:07 +0000 Subject: [PATCH] Fix jobs that take stdin input closing when resumed --- src/sighandler.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sighandler.hpp b/src/sighandler.hpp index 1bf19ea..3c86b22 100644 --- a/src/sighandler.hpp +++ b/src/sighandler.hpp @@ -145,8 +145,8 @@ bg_fg(int argc, char *argv[]) if (index == -1) syntax_error("Invalid job"); - kill(-j->pid, SIGCONT); if (!strcmp(argv[0], "bg")) { + kill(-j->pid, SIGCONT); j->state = BG; if (TERMINAL) { pid_t pid = j->pid; @@ -154,6 +154,8 @@ bg_fg(int argc, char *argv[]) } } else { j->state = FG; + tcsetpgrp(STDIN_FILENO, j->pid); + kill(-j->pid, SIGCONT); for ever { if (j->pid != getfg()) { if (TERMINAL)