This is a write-up of how one Electron app runs long external CLI jobs (multi-hour encodes and disc copies) that survive the app restarting. When the app comes back, it either re-attaches to the running job or works out from its log whether the job finished while nobody was watching.
The code below is a sanitized reconstruction meant for reuse, not a copy of the original. The last sections are an honest review of what has held up and what I'd change.