Mac – Activity process does not terminate

activity-monitormacvim

enter image description hereI am using a Mac and I use Macvim for programming. If my program happens to go into an infinite loop and I have to quit Macvim and restart it due to this the program will restart but the program process keeps running. I realized this when I opened up my activity monitor and see "program foo" is still running at about 99% cpu usage! I can easily shut down the process from activity monitor but is there a way to prevent this? Thanks in advance for any suggestions. Test is the file the loop went into. I created it to show an example.

Best Answer

MacVim forks (spawns a new process) to launch external processes, but it waits for the external process to return before resuming execution. Thus, killing MacVim simply detaches the child process (your program) from MacVim and attaches it to the main process running, in essence, OS X on the whole.

You have to quit, or Force Quit, your program explicitly in order to kill it.

It's also very likely that if you kill your program, and NOT MacVim, you can continue using MacVim without issue.