waybar/include
Mattéo Delabre d8706af2ea
Terminate custom module scripts on exit
(Fixes #358.)

Subprocesses created for custom module scripts were previously left
running when the parent Waybar process exited. This patch sets the
parent-death signal of child processes (PR_SET_PDEATHSIG on Linux,
PROC_PDEATHSIG_CTL on FreeBSD) to SIGTERM.

Caveats:

* This uses Linux-specific or FreeBSD-specific calls. I don’t know if
  this project targets other systems?
* There is a possibility that Waybar exits after calling `fork()`, but
  before calling `prctl` to set the parent-death signal. In this case,
  the child will not receive the SIGTERM signal and will continue to
  run. I did not handle this case as I consider it quite unlikely, since
  module scripts are usually launched only when Waybar starts. Please
  let me know if you think it needs to be handled.

Testing:

* With `htop` open, run Waybar v0.9.5 with a custom module that has an
  `exec` script. Terminate the Waybar process and notice that the
  script’s subprocess stays alive and is now a child of the init
  process.
* Run Waybar with this patch and follow the same steps as above. Notice
  that this time the script’s subprocess terminates when the parent
  exits.
2021-02-12 21:14:46 +01:00
..
modules refactor(bluetooth): remove interval and timer thread 2021-02-09 21:27:21 -08:00
util Terminate custom module scripts on exit 2021-02-12 21:14:46 +01:00
ALabel.hpp Removing 'click_param' as it is no longer used. 2020-11-01 16:03:39 +00:00
AModule.hpp fix: cancel thread and fix window close 2020-05-27 09:10:38 +02:00
bar.hpp Added waybar_output.identifier support. 2020-12-25 20:54:38 +00:00
client.hpp Merge pull request #842 from rdnetto/config-reloading 2021-01-18 12:06:25 +01:00
factory.hpp Add simpleclock as fallback when hhdate is not available 2020-10-29 19:40:28 +01:00
IModule.hpp refactor: AModule 2019-06-15 14:57:52 +02:00