Create Gradle task to execute command line

PHOTO EMBED

Wed Jan 26 2022 11:30:08 GMT+0000 (Coordinated Universal Time)

Saved by @larcos #kotlin

register<Exec>("restartAppServer") {
    group = "MyTasks"
    description = "Stops your local PS app server."
    workingDir(projectDir)
    commandLine("cmd", "/c", "restartAppServer.bat")
    standardOutput = ByteArrayOutputStream()
    val getOutput: () -> String = {
        standardOutput.toString()
    }
    doFirst { println(commandLine) }
    doLast {
        println(getOutput())
    }
}
content_copyCOPY