|
From: | Yuriy Pudgorodskiy |
Subject: | Re: [Qemu-devel] [PATCH 1/2] create ga_run_program() helper for guest-set-user-password |
Date: | Mon, 11 Jan 2016 15:08:47 +0300 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
On 1/6/2016 4:50 PM, Denis V. Lunev wrote:
hmmm.... Yur, it seems that you have re-invented the wheel withgboolean <https://developer.gnome.org/glib/stable/glib-Basic-Types.html#gboolean> g_spawn_sync (/|const gchar <https://developer.gnome.org/glib/stable/glib-Basic-Types.html#gchar> *working_directory|/, /|gchar <https://developer.gnome.org/glib/stable/glib-Basic-Types.html#gchar> **argv|/, /|gchar <https://developer.gnome.org/glib/stable/glib-Basic-Types.html#gchar> **envp|/, /|GSpawnFlags <https://developer.gnome.org/glib/stable/glib-Spawning-Processes.html#GSpawnFlags> flags|/, /|GSpawnChildSetupFunc <https://developer.gnome.org/glib/stable/glib-Spawning-Processes.html#GSpawnChildSetupFunc> child_setup|/, /|gpointer <https://developer.gnome.org/glib/stable/glib-Basic-Types.html#gpointer> user_data|/, /|gchar <https://developer.gnome.org/glib/stable/glib-Basic-Types.html#gchar> **standard_output|/, /|gchar <https://developer.gnome.org/glib/stable/glib-Basic-Types.html#gchar> **standard_error|/, /|gint <https://developer.gnome.org/glib/stable/glib-Basic-Types.html#gint> *exit_status|/, /|GError <https://developer.gnome.org/glib/stable/glib-Error-Reporting.html#GError> **error|/);
Not exactly. g_spawn_sync() wrapper cannot be used directly instead of my wrapper,because it does not support redirected stdin which is required to send data to chpasswd. g_spawn_async_with_pipes() can be used (with stdin), but it will not make code simpler.
Most of command-posix.c calls fork/execv directly, and so does the wrapper I wrote.
[Prev in Thread] | Current Thread | [Next in Thread] |