Added guard function to exit applications that need terminal input if they are running without a terminal.