|  |  |  | GNOME Video Arcade Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Properties | Signals | ||||
struct GvaProcess; GvaProcess * gva_process_new (GPid pid,gint priority,gint standard_input,gint standard_output,gint standard_error); GvaProcess * gva_process_spawn (const gchar *command_line,gint priority,GError **error); GPid gva_process_get_pid (GvaProcess *process); gboolean gva_process_write_stdin (GvaProcess *process,const gchar *data,gssize length,GError **error); guint gva_process_stdout_num_lines (GvaProcess *process); guint gva_process_stderr_num_lines (GvaProcess *process); gchar * gva_process_stdout_read_line (GvaProcess *process); gchar * gva_process_stderr_read_line (GvaProcess *process); gchar ** gva_process_stdout_read_lines (GvaProcess *process); gchar ** gva_process_stderr_read_lines (GvaProcess *process); guint gva_process_get_progress (GvaProcess *process); void gva_process_inc_progress (GvaProcess *process); void gva_process_set_progress (GvaProcess *process,guint progress); gboolean gva_process_has_exited (GvaProcess *process,gint *status); void gva_process_kill (GvaProcess *process); void gva_process_kill_all (void); void gva_process_get_time_elapsed (GvaProcess *process,GTimeVal *time_elapsed);
"pid" guint : Read / Write / Construct Only "priority" gint : Read / Write / Construct Only "progress" guint : Read / Write "stderr" gint : Read / Write / Construct Only "stdin" gint : Read / Write / Construct Only "stdout" gint : Read / Write / Construct Only
A GvaProcess provides a convenient interface for communicating with a child process through pipes.
struct GvaProcess;
Contains only private data that should be read and manipulated using the functions below.
GvaProcess * gva_process_new (GPid pid,gint priority,gint standard_input,gint standard_output,gint standard_error);
Creates a new GvaProcess from the given parameters.  A GSource is
created at the given priority for each of the file descriptors.  The
internal progress value is initialized to zero.
| 
 | child process ID | 
| 
 | priority for the event sources | 
| 
 | file descriptor for the child's stdin | 
| 
 | file descriptor for the child's stdout | 
| 
 | file descriptor for the child's stderr | 
| Returns : | a new GvaProcess | 
GvaProcess * gva_process_spawn (const gchar *command_line,gint priority,GError **error);
Spawns a child process with command_line and returns the resulting
GvaProcess.  If an error occurs while spawning, the function returns
NULL and sets error.
| 
 | a command line | 
| 
 | priority for the event sources | 
| 
 | return location for a GError, or NULL | 
| Returns : | a new GvaProcess, or NULLif an error occurred | 
GPid                gva_process_get_pid                 (GvaProcess *process);
Returns the process ID for process.
| 
 | a GvaProcess | 
| Returns : | process ID for process | 
gboolean gva_process_write_stdin (GvaProcess *process,const gchar *data,gssize length,GError **error);
Writes data to the stdin pipe of a child process represented by process.
If an error occurs, it returns FALSE and sets error.
| 
 | a GvaProcess | 
| 
 | the data to write to the child process | 
| 
 | length of the data, or -1 if the data is nul-terminated | 
| 
 | return location for a GError, or NULL | 
| Returns : | TRUEon success,FALSEif an error occurred | 
guint               gva_process_stdout_num_lines        (GvaProcess *process);
Returns the number of lines available for reading from the stdout pipe
of the child process represented by process.
| 
 | a GvaProcess | 
| Returns : | number of lines available for reading | 
guint               gva_process_stderr_num_lines        (GvaProcess *process);
Returns the number of lines available for reading from the stderr pipe
of the child process represented by process.
| 
 | a GvaProcess | 
| Returns : | number of lines available for reading | 
gchar *             gva_process_stdout_read_line        (GvaProcess *process);
Reads a line from the stdout pipe of the child process represented by
process.  This function does not block; it returns NULL if no lines
are available.  Use gva_process_stdout_num_lines() to peek at whether
any lines are available.  The line should be freed with g_free() when
no longer needed.
| 
 | a GvaProcess | 
| Returns : | a line from the child process' stdout, or NULL | 
gchar *             gva_process_stderr_read_line        (GvaProcess *process);
Reads a line from the stderr pipe of the child process represented by
process.  This function does not block; it returns NULL if no lines
are available.  Use gva_process_stderr_num_lines() to peek at whether
any lines are available.  The line should be freed with g_free() when
no longer needed.
| 
 | a GvaProcess | 
| Returns : | a line from the child process' stderr, or NULL | 
gchar **            gva_process_stdout_read_lines       (GvaProcess *process);
Returns a NULL-terminated array of lines from the stdout pipe of the
child process represented by process.  This function does not block;
it returns NULL if no lines are available.  Use
gva_process_stdout_num_lines() to peek at the number of lines available.
The array should be freed with g_strfreev() when no longer needed.
| 
 | a GvaProcess | 
| Returns : | a NULL-terminated array of lines from the child process'
stdout, orNULL | 
gchar **            gva_process_stderr_read_lines       (GvaProcess *process);
Returns a NULL-terminated array of lines from the stderr pipe of the
child process represented by process.  This function does not block;
it returns NULL if no lines are available.  Use
gva_process_stderr_num_lines() to peek at the number of lines available.
The array should be freed with g_strfreev() when no longer needed.
| 
 | a GvaProcess | 
| Returns : | a NULL-terminated array of lines from the child process'
stderr, orNULL | 
guint               gva_process_get_progress            (GvaProcess *process);
Returns the current progress value for process.  It is up to the
application to set this value using gva_process_set_progress() or
gva_process_inc_progress().
| 
 | a GvaProcess | 
| Returns : | progress value | 
void                gva_process_inc_progress            (GvaProcess *process);
Increments the progress value for process.  The progress value is
just a counter; it is up to the application to establish an upper
bound for the value.
| 
 | a GvaProcess | 
void gva_process_set_progress (GvaProcess *process,guint progress);
Sets the progress value for process.  The progress value is just a
counter; it is up to the application to establish an upper bound for
the value.
| 
 | a GvaProcess | 
| 
 | progress value | 
gboolean gva_process_has_exited (GvaProcess *process,gint *status);
Returns TRUE if the child process represented by process has exited
and writes the exit status to the location pointed to by status, if
status is non-NULL.  There may still be lines available for reading
even after the child process has exited.
| 
 | a GvaProcess | 
| 
 | return location for the exit status, or NULL | 
| Returns : | TRUEif the child process has exited,FALSEotherwise | 
void                gva_process_kill                    (GvaProcess *process);
Kills the child process represented by process by sending it a
"kill" signal.
| 
 | a GvaProcess | 
void                gva_process_kill_all                (void);
Kills all active child processes represented by GvaProcess instances by sending them "kill" signals.
void gva_process_get_time_elapsed (GvaProcess *process,GTimeVal *time_elapsed);
Writes the time elapsed since process (the GvaProcess instance, not
necessarily the child process it represents) was created to time_elapsed.
| 
 | a GvaProcess | 
| 
 | location to put the time elapsed | 
"pid" property  "pid"                      guint                 : Read / Write / Construct Only
The ID of the child process.
Default value: 0
"priority" property  "priority"                 gint                  : Read / Write / Construct Only
Priority of the event sources that watch for incoming data.
Default value: 200
"progress" property  "progress"                 guint                 : Read / Write
Progress value, the meaning of which is defined by the application.
Default value: 0
"stderr" property  "stderr"                   gint                  : Read / Write / Construct Only
The file descriptor for the child process' stderr pipe.
Allowed values: >= -1
Default value: -1
"stdin" property  "stdin"                    gint                  : Read / Write / Construct Only
The file descriptor for the child process' stdin pipe.
Allowed values: >= -1
Default value: -1
"exited" signalvoid                user_function                      (GvaProcess *process,
                                                        gint        status,
                                                        gpointer    user_data)      : Run First
The ::exited signal is emitted when the child process exits.
| 
 | the GvaProcess that received the signal | 
| 
 | the exit status of the child process | 
| 
 | user data set when the signal handler was connected. | 
"stderr-ready" signalvoid                user_function                      (GvaProcess *process,
                                                        gpointer    user_data)      : Run Last
The ::stderr-ready signal is emitted when one or more lines from the child process' stderr pipe are available for reading.
| 
 | the GvaProcess that received the signal | 
| 
 | user data set when the signal handler was connected. | 
"stdout-ready" signalvoid                user_function                      (GvaProcess *process,
                                                        gpointer    user_data)      : Run Last
The ::stdout-ready signal is emitted when one or more lines from the child process' stdout pipe are available for reading.
| 
 | the GvaProcess that received the signal | 
| 
 | user data set when the signal handler was connected. |