From 6d9469d916bb80aa76c82097e60b725de1661d5c Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 1 Sep 2026 10:41:39 +0000 Subject: real foreground/background --- src/ground.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/ground.cc') diff --git a/src/ground.cc b/src/ground.cc index 54a333f..265a22d 100644 --- a/src/ground.cc +++ b/src/ground.cc @@ -5,6 +5,9 @@ using namespace std; namespace ov4 { +pid_t shell_pgid; +int tty_fd; + /* * waitfg - Block until process pid is no longer the foreground process */ @@ -17,6 +20,11 @@ void waitfg(pid_t pid) LOG << "waiting for pid "<< fgpid(jobs) << endl; while (fgpid(jobs) != 0) sigsuspend(&prev_with_sigchld_unblocked); + + // set shell to foreground again + tcsetpgrp(tty_fd, shell_pgid); + sigprocmask(SIG_BLOCK, &block_io, nullptr); + LOG << "finished fg " << endl; return; } -- cgit v1.3.1-4-g156e