Add a new ecore exe flag, ECORE_EXE_TERM_WITH_PARENT,
that will operate on child process,
sending a SIGTERM when parent process dies.
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@63915
7cbeb6ba-43b4-40fd-8cce-
4c39aea84d33
ECORE_EXE_PIPE_AUTO = 32, /**< stdout and stderr are buffered automatically */
ECORE_EXE_RESPAWN = 64, /**< FIXME: Exe is restarted if it dies */
ECORE_EXE_USE_SH = 128, /**< Use /bin/sh to run the command. */
- ECORE_EXE_NOT_LEADER = 256 /**< Do not use setsid() to have the executed process be its own session leader */
+ ECORE_EXE_NOT_LEADER = 256, /**< Do not use setsid() to have the executed process be its own session leader */
+ ECORE_EXE_TERM_WITH_PARENT = 512 /**< Makes child receive SIGTERM when parent dies. */
};
typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags;
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
+#include <sys/prctl.h>
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
}
}
+ if ((flags & ECORE_EXE_TERM_WITH_PARENT))
+ {
+ prctl(PR_SET_PDEATHSIG, SIGTERM);
+ }
+
if (!(flags & ECORE_EXE_NOT_LEADER)) setsid();
if ((flags & ECORE_EXE_USE_SH))
{