23#define GEANY_SPAWN_H 1
28# define SPAWN_WIFEXITED(status) TRUE
29# define SPAWN_WEXITSTATUS(status) (status)
30# define SPAWN_WIFSIGNALED(status) FALSE
32# include <sys/types.h>
34# define SPAWN_WIFEXITED(status) WIFEXITED(status)
35# define SPAWN_WEXITSTATUS(status) WEXITSTATUS(status)
36# define SPAWN_WIFSIGNALED(status) WIFSIGNALED(status)
45gboolean
spawn_async(
const gchar *working_directory,
const gchar *command_line, gchar **argv,
46 gchar **envp, GPid *child_pid, GError **
error);
80typedef void (*
SpawnReadFunc)(GString *string, GIOCondition condition, gpointer data);
83 gchar **argv, gchar **envp,
SpawnFlags spawn_flags, GIOFunc stdin_cb, gpointer stdin_data,
84 SpawnReadFunc stdout_cb, gpointer stdout_data, gsize stdout_max_length,
85 SpawnReadFunc stderr_cb, gpointer stderr_data, gsize stderr_max_length,
86 GChildWatchFunc exit_cb, gpointer exit_data, GPid *child_pid, GError **
error);
100gboolean
spawn_sync(
const gchar *working_directory,
const gchar *command_line, gchar **argv,
101 gchar **envp,
SpawnWriteData *stdin_data, GString *stdout_data, GString *stderr_data,
102 gint *exit_status, GError **
error);
void error(const errorSelection selection, const char *const format,...)
gboolean spawn_with_callbacks(const gchar *working_directory, const gchar *command_line, gchar **argv, gchar **envp, SpawnFlags spawn_flags, GIOFunc stdin_cb, gpointer stdin_data, SpawnReadFunc stdout_cb, gpointer stdout_data, gsize stdout_max_length, SpawnReadFunc stderr_cb, gpointer stderr_data, gsize stderr_max_length, GChildWatchFunc exit_cb, gpointer exit_data, GPid *child_pid, GError **error)
<simplesect kind="geany:skip"></simplesect> Executes a child program and setups callbacks.
gboolean spawn_async(const gchar *working_directory, const gchar *command_line, gchar **argv, gchar **envp, GPid *child_pid, GError **error)
Executes a child asynchronously.
gboolean spawn_check_command(const gchar *command_line, gboolean execute, GError **error)
Checks whether a command line is valid.
void(* SpawnReadFunc)(GString *string, GIOCondition condition, gpointer data)
Specifies the type of function passed to spawn_with_callbacks() as stdout or stderr callback.
SpawnFlags
Flags passed to spawn_with_callbacks(), which see.
@ SPAWN_STDOUT_RECURSIVE
The stdout callback is recursive.
@ SPAWN_ASYNC
Asynchronous execution [default].
@ SPAWN_RECURSIVE
All callbacks are recursive.
@ SPAWN_LINE_BUFFERED
stdout/stderr are line buffered [default].
@ SPAWN_STDOUT_UNBUFFERED
stdout is not buffered.
@ SPAWN_UNBUFFERED
stdout/stderr are not buffered.
@ SPAWN_STDIN_RECURSIVE
The stdin callback is recursive.
@ SPAWN_STDERR_UNBUFFERED
stderr is not buffered.
@ SPAWN_STDERR_RECURSIVE
The stderr callback is recursive.
@ SPAWN_SYNC
Synchronous execution.
struct _SpawnWriteData SpawnWriteData
A simple structure used by spawn_write_data() to write data to a channel.
gboolean spawn_sync(const gchar *working_directory, const gchar *command_line, gchar **argv, gchar **envp, SpawnWriteData *stdin_data, GString *stdout_data, GString *stderr_data, gint *exit_status, GError **error)
Executes a child synchronously.
gboolean spawn_write_data(GIOChannel *channel, GIOCondition condition, SpawnWriteData *data)
Writes (a portion of) the data pointed by data->ptr to the channel.
gboolean spawn_kill_process(GPid pid, GError **error)
Kills a process.
A simple structure used by spawn_write_data() to write data to a channel.
gsize size
Size of the data.
const gchar * ptr
Pointer to the data.