Top |
UDisksSpawnedJob * | udisks_spawned_job_new () |
const gchar * | udisks_spawned_job_get_command_line () |
gchar * | command-line | Read / Write / Construct Only |
gchar * | input-string | Write / Construct Only |
guint | run-as-euid | Write / Construct Only |
guint | run-as-uid | Write / Construct Only |
GObject ╰── GDBusInterfaceSkeleton ╰── UDisksJobSkeleton ╰── UDisksBaseJob ╰── UDisksSpawnedJob
This type provides an implementation of the UDisksJob interface for jobs that are implemented by spawning a command line.
UDisksSpawnedJob * udisks_spawned_job_new (const gchar *command_line
,const gchar *input_string
,uid_t run_as_uid
,uid_t run_as_euid
,UDisksDaemon *daemon
,GCancellable *cancellable
);
Creates a new UDisksSpawnedJob instance.
The job is started immediately - connect to the “spawned-job-completed” or “completed” signals to get notified when the job is done.
command_line |
The command line to run. |
|
input_string |
A string to write to stdin of the spawned program or |
|
run_as_uid |
The uid_t to run the program as. |
|
run_as_euid |
The effective uid_t to run the program as. |
|
daemon |
A UDisksDaemon. |
|
cancellable |
A GCancellable or |
const gchar *
udisks_spawned_job_get_command_line (UDisksSpawnedJob *job
);
Gets the command line that job
was constructed with.
typedef struct _UDisksSpawnedJob UDisksSpawnedJob;
The UDisksSpawnedJob structure contains only private data and should only be accessed using the provided API.
“command-line”
property “command-line” gchar *
The command-line to run.
Flags: Read / Write / Construct Only
Default value: NULL
“input-string”
property “input-string” gchar *
String that will be written to stdin of the spawned program or
NULL
to not write anything.
Flags: Write / Construct Only
Default value: NULL
“run-as-euid”
property “run-as-euid” guint
The effective uid_t to run the program as.
Flags: Write / Construct Only
Default value: 0
“spawned-job-completed”
signalgboolean user_function (UDisksSpawnedJob *job, GError *error, gint status, GString *standard_output, GString *standard_error, gpointer user_data)
Emitted when the spawned job is complete. If spawning the command
failed or if the job was cancelled, error
will
non-NULL
. Otherwise you can use macros such as WIFEXITED()
and
WEXITSTATUS()
on the status
integer to obtain more information.
The default implementation simply emits the “completed”
signal with success
set to TRUE
if, and only if, error
is
NULL
, WIFEXITED()
evaluates to TRUE
and WEXITSTATUS()
is
zero. Additionally, message
on that signal is set to
standard_error
regards of whether success
is TRUE
or FALSE
.
You can avoid the default implementation by returning TRUE
from
your signal handler.
This signal is emitted in the
thread-default main loopof the thread that job
was created in.
job |
The UDisksSpawnedJob emitting the signal. |
|
error |
|
|
status |
The exit status of the command line that was run. |
|
standard_output |
Standard output from the command line that was run. |
|
standard_error |
Standard error output from the command line that was run. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last