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

This commit is contained in:
2026-05-07 07:32:44 +02:00
parent 2523340d08
commit ecf6edb826
4 changed files with 59 additions and 11 deletions
+11 -4
View File
@@ -18,12 +18,15 @@ namespace Montauk {
if (!ResolveProcessPath(path, resolved, sizeof(resolved))) return -1;
int parentSlot = Ipc::CurrentSlot();
int childPid = Sched::Spawn(resolved, args);
int childPid = Sched::Spawn(resolved, args, false);
if (childPid < 0) return -1;
auto* child = Sched::GetProcessByPid(childPid);
int childSlot = Ipc::SlotForPid(childPid);
if (child == nullptr || childSlot < 0 || parentSlot < 0) return -1;
if (child == nullptr || childSlot < 0 || parentSlot < 0) {
Sched::KillProcess(childPid);
return -1;
}
Ipc::Stream* outStream = Ipc::CreateStream();
Ipc::Stream* inStream = Ipc::CreateStream();
@@ -68,8 +71,12 @@ namespace Montauk {
child->redirected = true;
child->parentPid = Sched::GetCurrentPid();
child->termCols = 0;
child->termRows = 0;
child->termCols = 80;
child->termRows = 25;
if (Sched::StartProcess(childPid) < 0) {
Sched::KillProcess(childPid);
return -1;
}
return childPid;
}