summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eee49b6)
raw | patch | inline | side by side (parent: eee49b6)
author | Johannes Sixt <j6t@kdbg.org> | |
Sun, 11 Apr 2010 20:40:12 +0000 (22:40 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 11 Apr 2010 20:48:46 +0000 (13:48 -0700) |
A caller of start_command can set the member 'dir' to a directory to
request that the child process starts with that directory as CWD. The first
user of this feature was added recently in eee49b6 (Teach diff --submodule
and status to handle .git files in submodules).
On Windows, we have been lazy and had not implemented support for this
feature, yet. This fixes the shortcoming.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
request that the child process starts with that directory as CWD. The first
user of this feature was added recently in eee49b6 (Teach diff --submodule
and status to handle .git files in submodules).
On Windows, we have been lazy and had not implemented support for this
feature, yet. This fixes the shortcoming.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw.c | patch | blob | history | |
compat/mingw.h | patch | blob | history | |
run-command.c | patch | blob | history |
diff --git a/compat/mingw.c b/compat/mingw.c
index ab65f77ab99500d99d24a9b7266669f37bb02cb2..754b5340b087841aaa7601c784c8ca9f15ed64a6 100644 (file)
--- a/compat/mingw.c
+++ b/compat/mingw.c
}
static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **env,
+ const char *dir,
int prepend_cmd, int fhin, int fhout, int fherr)
{
STARTUPINFO si;
memset(&pi, 0, sizeof(pi));
ret = CreateProcess(cmd, args.buf, NULL, NULL, TRUE, flags,
- env ? envblk.buf : NULL, NULL, &si, &pi);
+ env ? envblk.buf : NULL, dir, &si, &pi);
if (env)
strbuf_release(&envblk);
static pid_t mingw_spawnve(const char *cmd, const char **argv, char **env,
int prepend_cmd)
{
- return mingw_spawnve_fd(cmd, argv, env, prepend_cmd, 0, 1, 2);
+ return mingw_spawnve_fd(cmd, argv, env, NULL, prepend_cmd, 0, 1, 2);
}
pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **env,
+ const char *dir,
int fhin, int fhout, int fherr)
{
pid_t pid;
pid = -1;
}
else {
- pid = mingw_spawnve_fd(iprog, argv, env, 1,
+ pid = mingw_spawnve_fd(iprog, argv, env, dir, 1,
fhin, fhout, fherr);
free(iprog);
}
argv[0] = argv0;
}
else
- pid = mingw_spawnve_fd(prog, argv, env, 0,
+ pid = mingw_spawnve_fd(prog, argv, env, dir, 0,
fhin, fhout, fherr);
free(prog);
}
diff --git a/compat/mingw.h b/compat/mingw.h
index e254fb4e068c3248a1aac33d70e40b620cd91088..e0a6abac510610f5779e8df68fab2ad8424ce8c4 100644 (file)
--- a/compat/mingw.h
+++ b/compat/mingw.h
#define utime mingw_utime
pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **env,
+ const char *dir,
int fhin, int fhout, int fherr);
void mingw_execvp(const char *cmd, char *const *argv);
#define execvp mingw_execvp
diff --git a/run-command.c b/run-command.c
index 2feb493951322617692085998ac8507cdba9dd30..db30cd5fe29b9d9af11860da316ac1f45e290593 100644 (file)
--- a/run-command.c
+++ b/run-command.c
else if (cmd->out > 1)
fhout = dup(cmd->out);
- if (cmd->dir)
- die("chdir in start_command() not implemented");
if (cmd->env)
env = make_augmented_environ(cmd->env);
cmd->argv = prepare_shell_cmd(cmd->argv);
}
- cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, env,
+ cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, env, cmd->dir,
fhin, fhout, fherr);
failed_errno = errno;
if (cmd->pid < 0 && (!cmd->silent_exec_failure || errno != ENOENT))