diff --git a/compat/mingw.c b/compat/mingw.c index ca3ae4cb06..6632192690 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -322,3 +322,12 @@ int mingw_socket(int domain, int type, int protocol) } return s; } + +#undef exit +int git_exit(int code) +{ + if (code < 0) + exit(1); + exit(code); +} + diff --git a/git-compat-util.h b/git-compat-util.h index ddafec997f..9e075b715c 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -472,6 +472,9 @@ int mingw_socket(int domain, int type, int protocol); extern void quote_argv(const char **dst, const char **src); extern const char *parse_interpreter(const char *cmd); +extern __attribute__((noreturn)) int git_exit(int code); +#define exit git_exit + #endif /* __MINGW32__ */ #endif