Use native-platform to detect whether stdin is attached to a console, rather than `System.console()`, as this can detect more cases, such as when Gradle is running from mintty on Windows (e.g. the cygwin terminal). This allows the `init` task to prompt the user interactively when run from mintty on Windows.
Also consolidate some of the "is x connected to a console?" logic into a single place.