fix: add start pending mode to mitigate Terminal output redirection issue

This commit is contained in:
daniel committed 2026-05-07 07:32:44 +02:00
1 parent f9df9eba4d
commit d04d7194b9
4 files changed
+59 -11

No files matched your search

+7 -2
View File
@@ -46,10 +46,11 @@ namespace Montauk {
auto* parent = Sched::GetCurrentProcessPtr();
int parentSlot = Ipc::CurrentSlot();
int childPid = Sched::Spawn(resolved, args);
bool inheritRedirection = parent && parent->redirected;
int childPid = Sched::Spawn(resolved, args, !inheritRedirection);
if (childPid < 0) return childPid;
if (parent && parent->redirected) {
if (inheritRedirection) {
auto* child = Sched::GetProcessByPid(childPid);
int childSlot = Ipc::SlotForPid(childPid);
if (child == nullptr || childSlot < 0 || parentSlot < 0) {
@@ -71,6 +72,10 @@ namespace Montauk {
child->parentPid = parent->pid;
child->termCols = parent->termCols;
child->termRows = parent->termRows;
if (Sched::StartProcess(childPid) < 0) {
Sched::KillProcess(childPid);
return -1;
}
}
return childPid;