I have written an application on Raspbian using GTK 3. Overall, it has gone well, but now I need to shutdown the Pi from within the application. When the condition occurs, I run the following code:
/* Kick off the shutdown task. */
ShutdownProc= g_subprocess_new(G_SUBPROCESS_FLAGS_NONE,
&serror,
"/usr/bin/sudo",
"/usr/bin/shutdown",
"-h",
"+1",
NULL);
if (NULL == ShutdownProc) {
g_warning ("Shutdown failed: %s", serror->message);
}
The intent is to kick off the shutdown task with time to allow the application to shut down cleanly. I don’t get any error message, but the system does not shut down as expected.
Have I missed something?
Thanks