Kill `clever ng join` running sub-process on `clever ng leave`
Context
When a user joins a networkgroup (clever ng join) with a first terminal, it hangs and wait for a SIGINT/SIGTERM signal.
Problem
If they don't close this first terminal, and run clever ng leave in a second one, it makes them leave the networkgroup and remove all configuration files.
If they now leave from the first terminal (e.g. Ctrl+C), they will have errors.
Proposed solutions
-
Elegant but risky: When the user leaves from terminal 2, kill the process running in terminal 1. It might cause problems where a user automated these commands. Also, how to get the PID, and would it be possible to store the
clever ng joinsub-process PID somewhere (would store another thing on the device 😕)? - Safe but not great: Silently leave if errors occur (files not found).
- Balanced solution: Show error messages if errors occur on leave, but add informational message saying it might be normal if user left from another terminal.
Yeah, could do it too, now that we have a clever ng leave command 💁🏻♂️
@hsablonniere What do you think?
So a process would listen to the configuration SSE in the background?
Btw, I just realize I should add a security to avoid joining a networkgroup twice 💡
Edit: Reported in issue #459