Overhaul process spawning

This commit is contained in:
Justine Tunney 2023-09-10 08:12:43 -07:00
parent 99dc1281f5
commit 26e254fb4d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
96 changed files with 1848 additions and 1541 deletions

View file

@ -128,6 +128,7 @@ textwindows static char16_t *CreateStdinPipeName(char16_t *a, int64_t h) {
// this makes it possible for our read() implementation to periodically
// poll for signals while performing a blocking overlapped io operation
textwindows void WinMainStdin(void) {
uint32_t conmode;
char16_t pipename[64];
int64_t hStdin, hWriter, hReader, hThread, hSemaphore;
if (!SupportsWindows()) return;
@ -137,6 +138,10 @@ textwindows void WinMainStdin(void) {
Log("<stdin> GetStdHandle failed\n");
return;
}
if (!__imp_GetConsoleMode(hStdin, &conmode)) {
Log("<stdin> stdin not a console\n");
return;
}
CreateStdinPipeName(pipename, hStdin);
hReader = __imp_CreateFileW(pipename, kNtGenericRead, 0, 0, kNtOpenExisting,
kNtFileFlagOverlapped, 0);