docs: def main():
      """Run main, catching any exceptions and cleaning up the temp directories."""
  
      cleanup_and_exit = sys.exit # Function to do cleanup and exit before the import.
      exit_code = 0
  
      # Imports are done here inside the try block so some ugly (and useless)
      # traceback info is avoided on user's ^C (KeyboardInterrupt, EOFError on Windows).
      try:
          from . import external_program_calls as ex # Creates tmp dir as side effect.
          cleanup_and_exit = ex.cleanup_and_exit # Switch to the real one, deletes temp dir.
  
          from . import main_pdfCropMargins # Imports external_program_calls, don't do first.
          main_pdfCropMargins.main_crop() # Run the actual program.
  
      except (KeyboardInterrupt, EOFError): # Windows raises EOFError on ^C.
          print("\nGot a KeyboardInterrupt, cleaning up and exiting...\n",
                file=sys.stderr)
  
      except SystemExit:
          exit_code = sys.exc_info()[1]
          print()
  
      except:
          # Echo back the unexpected error so the user can see it.
          print("\nCaught an unexpected exception in the pdfCropMargins program.",
                                                                 file=sys.stderr)
          print("Unexpected error: ", sys.exc_info()[0], file=sys.stderr)
          print("Error message   : ", sys.exc_info()[1], file=sys.stderr)
          print()
          exit_code = 1
          import traceback
          max_traceback_length = 30
          traceback.print_tb(sys.exc_info()[2], limit=max_traceback_length)
          # raise # Re-raise the error.
  
      finally:
          # Some people like to hit multiple ^C chars, which kills cleanup.
          # Call cleanup again each time.
          for i in range(30): # Give up after 30 tries.
              try:
                  cleanup_and_exit(exit_code)
              except (KeyboardInterrupt, EOFError):
                  continue