Opening new buffer which is git show commit command

This commit is contained in:
Krzosa Karol
2024-08-08 07:24:13 +02:00
parent 161a9e3965
commit 080669b5e9
8 changed files with 55 additions and 16 deletions

View File

@@ -421,11 +421,24 @@ StdoutPollInfo PollStdout(Process *process, char *buffer, int64_t buffer_size) {
Assert(process->is_valid);
Win32Process *p = (Win32Process *)process->platform;
DWORD bytes_read = 0;
DWORD bytes_avail = 0;
bool peek_error = PeekNamedPipe(p->child_stdout_read, buffer, (DWORD)buffer_size, &bytes_read, &bytes_avail, NULL) == 0;
StdoutPollInfo result = {};
bool peek_error = PeekNamedPipe(p->child_stdout_read, NULL, 0, NULL, &bytes_avail, NULL) == 0;
if (peek_error) {
return result;
}
StdoutPollInfo result = {bytes_read, bytes_avail};
if (bytes_avail == 0) {
return result;
}
DWORD bytes_read = 0;
bool read_error = ReadFile(p->child_stdout_read, buffer, (DWORD)buffer_size, &bytes_read, 0) == 0;
if (read_error) {
return result;
}
result = {bytes_read, bytes_avail - bytes_read};
return result;
}