When developing apps using React Native, I realized that every time the packager opens, it will spawn a new process of
Terminal (Mac OS built-in shell app). This behavior is not too complicated to deal with if you are only using in local development.
Right click > Quit and everything will be done.
But with CI / CD, it's another story.
Basically, by the end of the Pipeline / Job in CI (in this example,
Gitlab), we need to kill the Terminal and its associated process
Terminal will restore itself first after being quit. Which leads to multiple redundant
Terminal windows opened at the same time, consuming significant resources.
- You have to quit Terminal and node first, yes, the command above:
- Trigger this command in the CI job:
This will delete all saved states created by Terminal earlier.
- This is optional: Lock the folder so that the state won't be spawned: