Ensure GUI-specific code doesn't run in the terminal.