From 75263a83a606beb79ae9ea388d9f043e8ddd0f9a Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Tue, 23 May 2006 12:27:28 -0500 Subject: [PATCH] MOO_CMD_OPEN_CONSOLE --- moo/mooutils/moocmd.c | 42 ++++++++++++++++++++++++++++++++++++------ moo/mooutils/moocmd.h | 3 ++- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/moo/mooutils/moocmd.c b/moo/mooutils/moocmd.c index c030f987..37bfefc8 100644 --- a/moo/mooutils/moocmd.c +++ b/moo/mooutils/moocmd.c @@ -61,6 +61,17 @@ static gboolean moo_cmd_run_command (MooCmd *cmd, gpointer user_data, GError **error); +#if 0 && defined(__WIN32__) +static gboolean moo_win32_spawn_async_with_pipes (const gchar *working_directory, + gchar **argv, + gchar **envp, + GSpawnFlags flags, + GPid *child_pid, + gint *standard_input, + gint *standard_output, + gint *standard_error, + GError **error); +#endif enum { @@ -482,16 +493,35 @@ moo_cmd_run_command (MooCmd *cmd, g_return_val_if_fail (!cmd->priv->running, FALSE); - if ((flags & G_SPAWN_STDOUT_TO_DEV_NULL) || (cmd_flags & MOO_CMD_STDOUT_TO_PARENT)) +#ifdef __WIN32__ + if (cmd_flags & MOO_CMD_OPEN_CONSOLE) + { outp = NULL; - else - outp = &cmd->priv->stdout; - - if ((flags & G_SPAWN_STDERR_TO_DEV_NULL) || (cmd_flags & MOO_CMD_STDERR_TO_PARENT)) errp = NULL; + } else - errp = &cmd->priv->stderr; +#endif + { + if ((flags & G_SPAWN_STDOUT_TO_DEV_NULL) || (cmd_flags & MOO_CMD_STDOUT_TO_PARENT)) + outp = NULL; + else + outp = &cmd->priv->stdout; + if ((flags & G_SPAWN_STDERR_TO_DEV_NULL) || (cmd_flags & MOO_CMD_STDERR_TO_PARENT)) + errp = NULL; + else + errp = &cmd->priv->stderr; + } + +#if 0 && defined(__WIN32__) + if (!(cmd_flags & MOO_CMD_OPEN_CONSOLE)) + result = moo_win32_spawn_async_with_pipes (working_dir, + argv, envp, + flags | G_SPAWN_DO_NOT_REAP_CHILD, + &cmd->priv->pid, + NULL, outp, errp, error); + else +#endif result = g_spawn_async_with_pipes (working_dir, argv, envp, flags | G_SPAWN_DO_NOT_REAP_CHILD, diff --git a/moo/mooutils/moocmd.h b/moo/mooutils/moocmd.h index 61e275cc..04b8197f 100644 --- a/moo/mooutils/moocmd.h +++ b/moo/mooutils/moocmd.h @@ -37,7 +37,8 @@ typedef enum { MOO_CMD_COLLECT_STDERR = 1 << 1, MOO_CMD_STDOUT_TO_PARENT = 1 << 2, MOO_CMD_STDERR_TO_PARENT = 1 << 3, - MOO_CMD_UTF8_OUTPUT = 1 << 4 + MOO_CMD_UTF8_OUTPUT = 1 << 4, + MOO_CMD_OPEN_CONSOLE = 1 << 5 } MooCmdFlags; struct _MooCmd