Make the Windows Console work better

The stdio reader thread now appears to be working recursively along
cosmopolitan subprocesses. For example, it's now possible to launch
vim.com from the unbourne.com bestline repl, thanks to hacks plus a
bug fix to select() timeouts.
This commit is contained in:
Justine Tunney 2023-09-07 16:03:19 -07:00
parent 032b1f3449
commit 8bdaddd81d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
68 changed files with 580 additions and 346 deletions

View file

@ -56,8 +56,10 @@ int sys_select_nt(int nfds, fd_set *readfds, fd_set *writefds,
}
// convert the wait time to a word
if (!timeout || ckd_add(&millis, timeout->tv_sec, timeout->tv_usec / 1000)) {
if (!timeout) {
millis = -1;
} else {
millis = timeval_tomillis(*timeout);
}
// call our nt poll implementation
@ -76,8 +78,7 @@ int sys_select_nt(int nfds, fd_set *readfds, fd_set *writefds,
// store remaining time back in caller's timeval
if (timeout) {
timeout->tv_sec = millis / 1000;
timeout->tv_usec = millis % 1000 * 1000;
*timeout = timeval_frommillis(millis);
}
return fdcount;