aboutsummaryrefslogtreecommitdiff
path: root/src/ground.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-09-01 10:41:39 +0000
committer_ov4 <ov4@ov4.org>2026-09-01 10:41:39 +0000
commit6d9469d916bb80aa76c82097e60b725de1661d5c (patch)
tree1c8d4f046c46d387914bc73fd912dd6eac950a0d /src/ground.cc
parent94c449ca42bd29de2c2fd137945550fe110fcd17 (diff)
real foreground/background
Diffstat (limited to 'src/ground.cc')
-rw-r--r--src/ground.cc8
1 files changed, 8 insertions, 0 deletions
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;
}