utils.py: Rework `is_main_process` to allow for running the cli in a subprocess

This will allow us a better isolation for tests, as we would now be able
to run them in subprocesses.
2 files changed