spawn: Create sessions for processes (FS#851)

Each process spawned from awesome now gets its own session and process group.
This makes sure they aren't connected to awesome in any way any more. This
especially fixes some problems with signals.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-12-04 13:19:01 +01:00
parent 7898cc7de7
commit f05dabd76e
1 changed files with 7 additions and 1 deletions

View File

@ -260,6 +260,12 @@ spawn_launchee_timeout(struct ev_loop *loop, ev_timer *w, int revents)
p_delete(&w); p_delete(&w);
} }
static void
spawn_callback(gpointer user_data)
{
setsid();
}
/** Spawn a command. /** Spawn a command.
* \param command_line The command line to launch. * \param command_line The command line to launch.
* \param error A error pointer to fill with the possible error from * \param error A error pointer to fill with the possible error from
@ -277,7 +283,7 @@ spawn_command(const gchar *command_line, GError **error)
return 0; return 0;
retval = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, retval = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, &pid, error); spawn_callback, NULL, &pid, error);
g_strfreev (argv); g_strfreev (argv);
if (!retval) if (!retval)