Helper functions for detecting whether we have stdin or do we run in a headless mode (e.g. system service).