dennismdejong commented on code in PR #13664:
URL: https://github.com/apache/gravitino/pull/13664#discussion_r4215893187
##########
build.gradle.kts:
##########
@@ -1710,53 +1710,63 @@ fun checkMacDockerConnector() {
return
}
- try {
- val processName = "docker-connector"
- val command = "pgrep -x -q $processName"
-
- val execResult = project.exec {
- commandLine("bash", "-c", command)
- }
- if (execResult.exitValue == 0) {
- project.extra["macDockerConnector"] = true
+ // `pgrep` exits with 0 when at least one process matches the given name and
with 1 when no
+ // process matches, so exit code 1 only tells us that `docker-connector` is
not running.
+ val exitCode =
+ try {
+ ProcessBuilder("pgrep", "-x", "-q", "docker-connector").start().waitFor()
+ } catch (e: IOException) {
+ println("checkMacDockerConnector failed: unable to run `pgrep`:
${e.message}")
+ return
}
- } catch (e: Exception) {
- println("checkContainerRunning failed: ${e.message}")
+
+ if (exitCode == 0) {
+ project.extra["macDockerConnector"] = true
+ } else if (exitCode != 1) {
+ println(
+ "checkMacDockerConnector failed: `pgrep -x -q docker-connector` exited
with code $exitCode"
+ )
}
}
fun checkDockerStatus() {
- try {
- val process = ProcessBuilder("docker", "info").start()
- val exitCode = process.waitFor()
-
- if (exitCode == 0) {
- project.extra["dockerRunning"] = true
- } else {
- println("checkDockerStatus failed with exit code $exitCode")
+ val exitCode =
+ try {
+ ProcessBuilder("docker", "info").start().waitFor()
+ } catch (e: IOException) {
+ // The `docker` command is not installed or not on the PATH. The status
summary and the tips
Review Comment:
@/var/folders/8k/vzjvz0113bl69n4_cxxq6v1w0000gn/T/opencode/pr13664-reply.md
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]