Skip to content

Commit 3b2bee6

Browse files
committed
Fix Windows artifact refresh using MoveFileExA
Signed-off-by: Ayush7Ranjan <aayushranjan48@gmail.com>
1 parent e599df1 commit 3b2bee6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/pipeline/artifact.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ enum {
3636
#include <sys/stat.h>
3737
#include <time.h>
3838
#include <unistd.h>
39+
#ifdef _WIN32
40+
#include <windows.h>
41+
#endif
3942

4043
/* ── Helpers ──────────────────────────────────────────────────────── */
4144

@@ -98,7 +101,11 @@ static int write_file_atomic(const char *path, const char *data, size_t len) {
98101
cbm_unlink(tmp);
99102
return CBM_NOT_FOUND;
100103
}
104+
#ifdef _WIN32
105+
if (!MoveFileExA(tmp, path, MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH)) {
106+
#else
101107
if (rename(tmp, path) != 0) {
108+
#endif
102109
cbm_unlink(tmp);
103110
return CBM_NOT_FOUND;
104111
}

0 commit comments

Comments
 (0)