mirror of
https://github.com/git/git.git
synced 2026-03-13 18:33:25 +01:00
Reimplement execvp() such that it can invoke shell scripts.
We conveniently reuse mingw_execve(), which does the shbang interpretation as well as other painful Windows compatibility stuff.
This commit is contained in:
@@ -529,6 +529,20 @@ void mingw_free_path_split(char **path)
|
||||
free(path);
|
||||
}
|
||||
|
||||
void mingw_execvp(const char *cmd, const char **argv)
|
||||
{
|
||||
char **path = mingw_get_path_split();
|
||||
char *prog = mingw_path_lookup(cmd, path);
|
||||
|
||||
if (prog) {
|
||||
mingw_execve(prog, argv, (const char **) environ);
|
||||
free(prog);
|
||||
} else
|
||||
errno = ENOENT;
|
||||
|
||||
mingw_free_path_split(path);
|
||||
}
|
||||
|
||||
int mingw_socket(int domain, int type, int protocol)
|
||||
{
|
||||
SOCKET s = WSASocket(domain, type, protocol, NULL, 0, 0);
|
||||
|
||||
@@ -430,6 +430,8 @@ unsigned int alarm(unsigned int seconds);
|
||||
#include <winsock2.h>
|
||||
void mingw_execve(const char *cmd, const char **argv, const char **env);
|
||||
#define execve mingw_execve
|
||||
extern void mingw_execvp(const char *cmd, const char **argv);
|
||||
#define execvp mingw_execvp
|
||||
int fork();
|
||||
typedef int pid_t;
|
||||
#define waitpid(pid, status, options) \
|
||||
|
||||
Reference in New Issue
Block a user