Open HellsingDarge opened 2 years ago
I don't have access to a WIndows machine anymore so it'd be great if you could open a PR that has reproc wait for the process to finish initializing using WaitForInputIdle.
Which is used to wait for a window's object to be fully initialised (it's opened and displaying) and waiting for input (keypress, mouse, minimise, resize etc). And as I've searched through Microsoft docs, there doesn't seem to be a function that waits until all DLLs are loaded for a process, so the only option left is to arbitrarily wait after creation and hope that no out/err is lost before the drain is set up.
CreateProcess
returns when the process begun starting rather than it has fully started and it's waiting for inputs/processing, which can lead to errors (e.g. 0xC0000142) when the object holding theprocess
instance or the executable context itself exits before it's fully started