![]() |
![]() |
![]() |
UDisks Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
UDisksSpawnedJob; 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
); const gchar * udisks_spawned_job_get_command_line (UDisksSpawnedJob *job
);
GObject +----GDBusInterfaceSkeleton +----UDisksJobSkeleton +----UDisksBaseJob +----UDisksSpawnedJob
"command-line" gchar* : Read / Write / Construct Only "input-string" gchar* : Write / Construct Only "run-as-euid" guint : Write / Construct Only "run-as-uid" guint : Write / Construct Only
This type provides an implementation of the UDisksJob interface for jobs that are implemented by spawning a command line.
typedef struct _UDisksSpawnedJob UDisksSpawnedJob;
The UDisksSpawnedJob structure contains only private data and should only be accessed using the provided API.
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.
|
The command line to run. |
|
A string to write to stdin of the spawned program or NULL . |
|
The uid_t to run the program as. |
|
The effective uid_t to run the program as. |
|
A UDisksDaemon. |
|
A GCancellable or NULL . |
Returns : |
A new UDisksSpawnedJob. Free with g_object_unref() . |
const gchar * udisks_spawned_job_get_command_line (UDisksSpawnedJob *job
);
Gets the command line that job
was constructed with.
|
A UDisksSpawnedJob. |
Returns : |
A string owned by job . Do not free. |
"command-line"
property "command-line" gchar* : Read / Write / Construct Only
The command-line to run.
Default value: NULL
"input-string"
property "input-string" gchar* : Write / Construct Only
String that will be written to stdin of the spawned program or
NULL
to not write anything.
Default value: NULL
"run-as-euid"
property "run-as-euid" guint : Write / Construct Only
The effective uid_t to run the program as.
Default value: 0
"spawned-job-completed"
signalgboolean user_function (UDisksSpawnedJob *job,
GError *error,
gint status,
GString *standard_output,
GString *standard_error,
gpointer user_data) : Run Last
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 loop
of the thread that job
was created in.
|
The UDisksSpawnedJob emitting the signal. |
|
NULL if running the whole command line succeeded, otherwise a GError that is set. |
|
The exit status of the command line that was run. |
|
Standard output from the command line that was run. |
|
Standard error output from the command line that was run. |
|
user data set when the signal handler was connected. |
Returns : |
TRUE if the signal was handled, FALSE to let other
handlers run. |