Created
February 23, 2019 09:14
-
-
Save Kuanlin-Chen/5abece706ac450d644677d770ae49ec9 to your computer and use it in GitHub Desktop.
Check command exists or not in Gradle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task checkCommand{ | |
doLast{ | |
def result = exec{ | |
def command = "command -v docker" | |
ignoreExitValue = true | |
executable "bash" args "-l", "-c", command | |
} | |
if(result.getExitValue()==0){ | |
println "Has Docker" | |
}else{ | |
print "No Docker" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment