Skip to content

Commit

Permalink
Fix jobs that take stdin input closing when resumed
Browse files Browse the repository at this point in the history
  • Loading branch information
Edd12321 committed Jul 7, 2023
1 parent 0389bba commit fcc214e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sighandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,17 @@ 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;
std::cerr << FMT;
}
} else {
j->state = FG;
tcsetpgrp(STDIN_FILENO, j->pid);
kill(-j->pid, SIGCONT);
for ever {
if (j->pid != getfg()) {
if (TERMINAL)
Expand Down

0 comments on commit fcc214e

Please sign in to comment.