On 1/6/2016 4:50 PM, Denis V. Lunev wrote:
hmmm....
Yur,
it seems that you have re-invented the wheel with
gboolean
<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.