systemd-updates: write the log file if the user does Ctrl+C on the pk-offline-update binary
This commit is contained in:
parent
c81a4100a5
commit
079138f33f
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-unix.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <gio/gio.h>
|
||||
@ -526,6 +527,18 @@ pk_offline_update_loop_quit_cb (gpointer user_data)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* pk_offline_update_sigint_cb:
|
||||
**/
|
||||
static gboolean
|
||||
pk_offline_update_sigint_cb (gpointer user_data)
|
||||
{
|
||||
PkOfflineUpdateHelper *helper = (PkOfflineUpdateHelper *) user_data;
|
||||
pk_log_warning (helper, "Handling SIGINT");
|
||||
pk_log_write (helper);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* main:
|
||||
**/
|
||||
@ -562,6 +575,13 @@ main (int argc, char *argv[])
|
||||
helper->log = g_string_new ("started\n");
|
||||
helper->time_started = g_get_real_time ();
|
||||
|
||||
/* do stuff on ctrl-c */
|
||||
g_unix_signal_add_full (G_PRIORITY_DEFAULT,
|
||||
SIGINT,
|
||||
pk_offline_update_sigint_cb,
|
||||
helper,
|
||||
NULL);
|
||||
|
||||
/* get the list of packages to update */
|
||||
ret = g_file_get_contents (PK_OFFLINE_PREPARED_UPDATE_FILENAME,
|
||||
&packages_data,
|
||||
|
Loading…
Reference in New Issue
Block a user