Skip to content

Commit a51dd64

Browse files
committed
Processing (Windows): use GetOverlappedResultEx on WoA
1 parent 0d20164 commit a51dd64

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/common/processing_windows.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,30 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
130130
switch (GetLastError())
131131
{
132132
case ERROR_IO_PENDING:
133-
if (!timeout || WaitForSingleObject(hChildPipeRead, (DWORD) timeout) != WAIT_OBJECT_0)
133+
#if __aarch64__
134+
if (!GetOverlappedResultEx(hChildPipeRead, &overlapped, &nRead, timeout < 0 ? INFINITE : (DWORD) timeout, FALSE))
135+
#else
136+
// To support Windows 7
137+
if (timeout >= 0 && WaitForSingleObject(hChildPipeRead, (DWORD) timeout) != WAIT_OBJECT_0)
134138
{
135139
CancelIo(hChildPipeRead);
136140
TerminateProcess(hProcess, 1);
137141
return "WaitForSingleObject(hChildPipeRead) failed or timeout (try increasing --processing-timeout)";
138142
}
139143

140144
if (!GetOverlappedResult(hChildPipeRead, &overlapped, &nRead, FALSE))
145+
#endif
141146
{
142147
if (GetLastError() == ERROR_BROKEN_PIPE)
143148
return NULL;
144149

145150
CancelIo(hChildPipeRead);
146151
TerminateProcess(hProcess, 1);
147-
return "GetOverlappedResult(hChildPipeRead) failed";
152+
return "GetOverlappedResult"
153+
#if __arch64__
154+
"Ex"
155+
#endif
156+
"(hChildPipeRead) failed";
148157
}
149158
break;
150159

0 commit comments

Comments
 (0)