Windows: Implement start_command().

On Windows, we have spawnv() variants to run a child process instead of
fork()/exec(). In order to attach pipe ends to stdin, stdout, and stderr,
we have to use this idiom:

    save1 = dup(1);
    dup2(pipe[1], 1);
    spawnv();
    dup2(save1, 1);
    close(pipe[1]);

assuming that the descriptors created by pipe() are not inheritable.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
This commit is contained in:
Johannes Sixt
2007-12-07 22:08:59 +01:00
parent 897bb8cb2c
commit ba26f296f9
3 changed files with 153 additions and 14 deletions

View File

@ -165,3 +165,11 @@ sig_handler_t mingw_signal(int sig, sig_handler_t handler);
#define is_dir_sep(c) ((c) == '/' || (c) == '\\')
#define PATH_SEP ';'
#define PRIuMAX "I64u"
/*
* helpers
*/
char **copy_environ(void);
void free_environ(char **env);
char **env_setenv(char **env, const char *name);