If I create a process and two pipe sets for it, and that process needs at a certain time some user input, the GetExitCodeProcess() from the Windows C API returns always 1. As an example you can take the Windows time command, this will return:
The current time is: ...
Enter the new time:
And then exits immediately without waiting for input.
I don’t want the process to finish until the it has really finished so I can pipe input to it. How can I solve this issue.
I have built this loop (I still want to be able to determine when to process has finished):
for (;;)
{
/* Pipe input and output */
if (GetExitCodeProcess(...) != STILL_ACTIVE) break;
}
Thanks in advance.
GetExitCodeProcessdoesn’t returnSTILL_ACTIVE;STILL_ACTIVEis the exit code returned via thelpExitCodeout parameter. You need to test the exit code that was returned: