efl/exe: add term_with_parent flag

Summary:
same as ecore_exe

Depends on D11451

Reviewers: segfaultxavi, bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11465
This commit is contained in:
Mike Blumenkrantz 2020-03-12 12:15:34 -04:00
parent e6573154dc
commit 043a2c90ff
2 changed files with 14 additions and 2 deletions

View File

@ -552,7 +552,18 @@ _efl_exe_efl_task_run(Eo *obj, Efl_Exe_Data *pd)
int except[2] = { 0, -1 };
except[0] = pd->fd.exited_write;
eina_file_close_from(3, except);
#ifdef HAVE_PRCTL
if ((pd->flags & EFL_EXE_FLAGS_TERM_WITH_PARENT))
{
prctl(PR_SET_PDEATHSIG, SIGTERM);
}
#elif defined(HAVE_PROCCTL)
if ((pd->flags & EFL_EXE_FLAGS_TERM_WITH_PARENT))
{
int sig = SIGTERM;
procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &sig);
}
#endif
// actually execute!
_exec(cmd, pd->flags, td->flags);
// we couldn't exec... uh oh. HAAAAAAAALP!

View File

@ -18,7 +18,8 @@ enum @beta Efl.Exe_Flags {
[[Flags to customize process behavior.]]
none = 0, [[No special flags.]]
group_leader = 1, [[Process will be executed in its own session.]]
hide_io = 4 [[All console IO will be hidden.]]
hide_io = 4, [[All console IO will be hidden.]]
term_with_parent = 8, [[Makes child receive SIGTERM when parent dies.]]
}
class @beta Efl.Exe extends Efl.Task implements Efl.Io.Reader, Efl.Io.Writer, Efl.Io.Closer, Efl.Core.Command_Line