Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Python

Idiom #186 Exit program cleanly

Exit a program cleanly indicating no error to OS

import sys
sys.exit(0)

Since exit() ultimately “only” raises an exception, it will only exit the process when called from the main thread, and the exception is not intercepted.
#include <stdlib.h>
exit(EXIT_SUCCESS);

New implementation...