Process Supervisor by crwood · Pull Request #470 · gridsync/gridsync

This PR adds a new Supervisor class/module for handling -- and monitoring -- the execution of longer-lived background processes. Any processes started by the Supervisor (specifically, Gridsync's tahoe and magic-folder subprocesses) will be kept alive indefinitely and/or restarted in the event that they are killed by external factors (such as in the event of crash, OOM issues, etc.) -- or, at least, until the Supervisor is stopped. The Supervisor will also optionally prevent multiple instances of the same supervised process from launching (using pidfiles).

In addition to the primary process-supervisor functionality, this PR also refactors/updates some routines adjacent to the Tahoe and MagicFolder start/stop methods to facilitate restoring lost functionality after a process has been restarted (for example, by reloading configuration changes, reconnecting websockets to the appropriate logging and status endpoints, etc.) and slightly improves error handling when such processes fail to launch at application start up (specifically, by capturing the output of the failed command and displaying it to the user -- instead of simply showing the process' exit code as was done previously).

Closes #455