Skip to content

Commit 973d394

Browse files
committed
FIX: ANSI escape sequence handling was not working if compiled with Windows subsystem
1 parent 2c22bdd commit 973d394

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/os/win32/dev-stdio.c

+4-6
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,10 @@ static void close_stdio(void)
291291
ok = WriteFile(Std_Out, bp, ep - bp, &total, 0);
292292
bp = ep;
293293
}
294+
if (!ok) {
295+
req->error = GetLastError();
296+
return DR_ERROR;
297+
}
294298
} else { // for Windows SubSystem - must be converted to Win32 wide-char format
295299

296300
// Thankfully, MS provides something other than mbstowcs();
@@ -317,12 +321,6 @@ static void close_stdio(void)
317321
bp = Parse_ANSI_sequence(++cp, ep);
318322
}
319323
}
320-
321-
if (!ok) {
322-
req->error = GetLastError();
323-
return DR_ERROR;
324-
}
325-
326324
} while (bp < ep);
327325

328326
req->actual = req->length; // do not use "total" (can be byte or wide)

0 commit comments

Comments
 (0)