Method

GioApplicationCommandLineset_exit_status

since: 2.28

Declaration

void
g_application_command_line_set_exit_status (
  GApplicationCommandLine* cmdline,
  int exit_status
)

Description

Sets the exit status that will be used when the invoking process exits.

The return value of the GApplication::command-line signal is passed to this function when the handler returns. This is the usual way of setting the exit status.

In the event that you want the remote invocation to continue running and want to decide on the exit status in the future, you can use this call. For the case of a remote invocation, the remote process will typically exit when the last reference is dropped on cmdline. The exit status of the remote process will be equal to the last value that was set with this function.

In the case that the commandline invocation is local, the situation is slightly more complicated. If the commandline invocation results in the mainloop running (ie: because the use-count of the application increased to a non-zero value) then the application is considered to have been ‘successful’ in a certain sense, and the exit status is always zero. If the application use count is zero, though, the exit status of the local GApplicationCommandLine is used.

This method is a no-op if g_application_command_line_done() has been called.

Available since: 2.28

Parameters

exit_status

Type: int

The exit status.