Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
nob
nob.old
nob.exe
nob.exe.old
build/
13 changes: 8 additions & 5 deletions nob.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
#ifndef NOB_H_
#define NOB_H_
#ifdef _WIN32
#define _CRT_SECURE_NO_WARNINGS (1)
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS (1)
#endif
#endif

#ifndef NOBDEF
Expand Down Expand Up @@ -1166,10 +1168,11 @@ static Nob_Proc nob__cmd_start_process(Nob_Cmd cmd, Nob_Fd *fdin, Nob_Fd *fdout,
PROCESS_INFORMATION piProcInfo;
ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));

nob__win32_cmd_quote(cmd, &sb);
nob_sb_append_null(&sb);
BOOL bSuccess = CreateProcessA(NULL, sb.items, NULL, NULL, TRUE, 0, NULL, NULL, &siStartInfo, &piProcInfo);
nob_sb_free(sb);
Nob_String_Builder quoted = {0};
nob__win32_cmd_quote(cmd, &quoted);
nob_sb_append_null(&quoted);
BOOL bSuccess = CreateProcessA(NULL, quoted.items, NULL, NULL, TRUE, 0, NULL, NULL, &siStartInfo, &piProcInfo);
nob_sb_free(quoted);

if (!bSuccess) {
nob_log(NOB_ERROR, "Could not create child process for %s: %s", cmd.items[0], nob_win32_error_message(GetLastError()));
Expand Down
2 changes: 1 addition & 1 deletion tests/win32_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
int main(void) {
nob_log(NOB_ERROR, "First 100 Win32 API Errors:");
for (DWORD i = 0; i < 100; i++)
nob_log(NOB_ERROR, "%lu (0x%X): \"%s\"", i, i, nob_win32_error_message(i));
nob_log(NOB_ERROR, "%lu (0x%lX): \"%s\"", i, i, nob_win32_error_message(i));
return 0;
}