This commit is contained in:
snarmph 2026-07-06 11:29:13 +02:00
parent 7026872240
commit 144312744c
2 changed files with 28 additions and 15 deletions

22
colla.c
View file

@ -961,6 +961,10 @@ bool rg__match_here(instream_t r, instream_t t) {
if (rc == '$' && rcn == '\0') {
return istr_peek(&t) == '\0';
}
// if (rc == '\\') {
// istr_skip(&r, 1);
// return istr_peek(&r) == istr_peek(&t);
// }
if (!istr_is_finished(&t) && (rc == '.' || rc == istr_peek(&t))) {
istr_skip(&r, 1);
istr_skip(&t, 1);
@ -1112,7 +1116,6 @@ bool glob__match_here(instream_t *g, instream_t *t);
bool glob__match_star(instream_t *g, instream_t *t) {
char c = istr_get(g);
char n = istr_peek(g);
do {
if (istr_get(t) == c) {
return true;
@ -1475,6 +1478,10 @@ static arena_t arena__make_static(u8 *buf, usize len) {
// == HANDLE ====================================
str_t os_get_last_error_string(void) {
return os_get_error_string(os_get_last_error());
}
oshandle_t os_handle_zero(void) {
return (oshandle_t){0};
}
@ -1612,13 +1619,20 @@ void os_log_printv(const char *file, int line, os_log_level_e level, const char
log_event_t ev = {
.level = level,
.line = line,
.args = args,
// .args = args,
.fmt = fmt,
.file = file,
.time = &log_time,
// .time = &log_time,
};
va_copy(ev.args, args);
#if COLLA_WIN
localtime_s(&log_time, &t);
ev.time = &log_time;
#else
ev.time = localtime(&t);
#endif
for (int i = 0; i < os__log_cbs_count; ++i) {
if (os__log_cbs[i].level > level) {
continue;
@ -1803,6 +1817,7 @@ usize os_pad_to_page(usize byte_count) {
// == THREAD ====================================
#if !COLLA_NO_ATOMICS
void os_barrier_sync(os_barrier_t *b) {
atomic_inc_i64(&b->thread_value);
@ -1843,6 +1858,7 @@ i64range_t os_lane_range(u64 values_count) {
return (i64range_t){ thread_first_value, thread_last_value };
}
#endif
#if !COLLA_NO_CONDITION_VARIABLE

View file

@ -789,7 +789,7 @@ oshandle_t os_run_cmd_async(arena_t scratch, os_cmd_t *cmd, os_cmd_options_t *op
if (options && options->in) {
CreatePipe(&hstdin_read, &hstdin_write, &sa_attr, 0);
options->in->data = (uptr)hstdin_read;
options->in->data = (uptr)hstdin_write;
SetHandleInformation(hstdin_write, HANDLE_FLAG_INHERIT, 0);
}
@ -839,17 +839,11 @@ oshandle_t os_run_cmd_async(arena_t scratch, os_cmd_t *cmd, os_cmd_options_t *op
&proc_info
);
if (hstdout_write) {
CloseHandle(hstdout_write);
}
#define CLOSE_IF(x) if (x) CloseHandle(x)
if (hstderr_write) {
CloseHandle(hstderr_write);
}
if (hstdin_read) {
CloseHandle(hstdin_read);
}
CLOSE_IF(hstdout_write);
CLOSE_IF(hstderr_write);
CLOSE_IF(hstdin_read);
if (env) {
FreeEnvironmentStringsW(env);
@ -858,10 +852,13 @@ oshandle_t os_run_cmd_async(arena_t scratch, os_cmd_t *cmd, os_cmd_options_t *op
if (!success && !quiet) {
err("couldn't create process (%v): %v", cmd_str, os_get_error_string(os_get_last_error()));
CLOSE_IF(hstdout_read);
CLOSE_IF(hstderr_read);
CLOSE_IF(hstdin_write);
return os_handle_zero();
}
CloseHandle(proc_info.hThread);
CLOSE_IF(proc_info.hThread);
return (oshandle_t) {
.data = (uptr)proc_info.hProcess