fix: add start pending mode to mitigate Terminal output redirection issue
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user