Clang format, mouse rebind

This commit is contained in:
Krzosa Karol
2024-08-12 13:45:58 +02:00
parent 3251df6068
commit 2b48f30cfe
9 changed files with 155 additions and 52 deletions

View File

@@ -313,7 +313,6 @@ static void Win32CloseProcess(Process *process) {
if (p->child_stdin_read != INVALID_HANDLE_VALUE) CloseHandle(p->child_stdin_read);
if (p->child_stdin_write != INVALID_HANDLE_VALUE) CloseHandle(p->child_stdin_write);
process->is_valid = false;
*p = {};
}
static void Win32ProcessError(Process *process, String msg, String cmd) {
@@ -459,4 +458,23 @@ StdoutPollInfo PollStdout(Process *process, char *buffer, int64_t buffer_size) {
result = {bytes_read, bytes_avail - bytes_read};
return result;
}
}
void WriteStdin(Process *process, String string) {
if (string.len == 0) return;
Assert(process->is_valid);
Win32Process *p = (Win32Process *)process->platform;
DWORD written = 0;
bool write_error = WriteFile(p->child_stdin_write, string.data, (DWORD)string.len, &written, NULL) == 0;
Assert(write_error == false);
Assert(written == string.len);
}
void CloseStdin(Process *process) {
Win32Process *p = (Win32Process *)process->platform;
CloseHandle(p->child_stdin_write);
p->child_stdin_write = INVALID_HANDLE_VALUE;
}