mirror of https://github.com/djcb/mu.git
Child processes should be session leaders.
If not, when the session of mu is killed, these child processes are also killed. This scenario shows up when using mu4e: a PDF attachment, for example, is opened by Evince, but as soon as Emacs exits, Evince is also killed.
This commit is contained in:
parent
f49e808160
commit
887e75c4ee
|
@ -122,7 +122,7 @@ AS_IF([test "x$ac_cv_member_struct_dirent_d_ino" != "xyes"],
|
||||||
|
|
||||||
|
|
||||||
# we need these
|
# we need these
|
||||||
AC_CHECK_FUNCS([memset memcpy realpath setlocale strerror getpass])
|
AC_CHECK_FUNCS([memset memcpy realpath setlocale strerror getpass setsid])
|
||||||
AC_CHECK_FUNC(timegm,[],[AC_MSG_ERROR([missing required function timegm])])
|
AC_CHECK_FUNC(timegm,[],[AC_MSG_ERROR([missing required function timegm])])
|
||||||
|
|
||||||
# require pkg-config
|
# require pkg-config
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/
|
/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/
|
||||||
/*
|
/*
|
||||||
**
|
**
|
||||||
** Copyright (C) 2008-2013 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2008-2016 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This program is free software; you can redistribute it and/or modify
|
** This program is free software; you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
@ -330,6 +330,17 @@ mu_util_program_in_path (const char *prog)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the child to a group leader to avoid being killed when the
|
||||||
|
* parent group is killed.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
maybe_setsid (G_GNUC_UNUSED gpointer user_data)
|
||||||
|
{
|
||||||
|
#if HAVE_SETSID
|
||||||
|
setsid();
|
||||||
|
#endif /*HAVE_SETSID*/
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
mu_util_play (const char *path, gboolean allow_local, gboolean allow_remote,
|
mu_util_play (const char *path, gboolean allow_local, gboolean allow_remote,
|
||||||
|
@ -366,8 +377,8 @@ mu_util_play (const char *path, gboolean allow_local, gboolean allow_remote,
|
||||||
|
|
||||||
err = NULL;
|
err = NULL;
|
||||||
rv = g_spawn_async (NULL, (gchar**)&argv, NULL,
|
rv = g_spawn_async (NULL, (gchar**)&argv, NULL,
|
||||||
G_SPAWN_SEARCH_PATH, NULL, NULL, NULL,
|
G_SPAWN_SEARCH_PATH, maybe_setsid,
|
||||||
err);
|
NULL, NULL, err);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue