Examples cleanup.

This commit is contained in:
Erik C. Thauvin 2017-04-29 23:05:22 -07:00
parent a55d7f34eb
commit 5672ad96b0
2 changed files with 5 additions and 4 deletions

View file

@ -37,7 +37,8 @@ The `commandLine` directive is used to execute command line(s) during the build
exec {
commandLine("cmd", "/c", "stop.bat", dir = "../tomcat/bin", os = setOf(Os.WINDOWS))
commandLine("./stop.sh", dir = "../tomcat/bin", os = setOf(Os.MAC, Os.LINUX))
commandLine("sh", "-c", "ps aux | grep tomcat", fail = setOf(Fail.EXIT))
commandLine("sh", "-c", "ps aux | grep tomcat", os = setOf(Os.MAC, Os.LINUX), fail = setOf(Fail.EXIT))
commandLine("cmd", "/c", "tasklist | find \"tomcat\"", os = setOf(Os.WINDOWS), fail = setOf(Fail.EXIT))
}
```
@ -165,7 +166,7 @@ You could also redirect the error stream to a file:
```kotlin
exec {
commandLine("/bin/sh", "-c", "./stop.sh 2> error.txt", os = setOf(Os.LINUX))
commandLine("sh", "-c", "./stop.sh 2> error.txt", os = setOf(Os.LINUX))
commandLine("cmd", "/c", "stop.bat 2> error.txt", os = setOf(Os.WINDOWS))
}
```

View file

@ -39,14 +39,14 @@ val example = project {
dependsOn = listOf("exec", "run")
val echo = arrayOf("echo", "Test", "Example")
commandLine("cmd", "/c", *echo, os = setOf(Os.WINDOWS))
commandLine(*echo, os = setOf(Os.LINUX, Os.MINGW, Os.CYGWIN))
commandLine("cmd", "/c", *echo, os = setOf(Os.WINDOWS))
}
exec {
taskName = "ps"
dependsOn = listOf() // no dependencies
commandLine("cmd", "/c", "tasklist | find \"cmd.exe\"", os = setOf(Os.WINDOWS), fail = setOf(Fail.NONE))
commandLine("sh", "-c", "ps aux | grep bash", os = setOf(Os.LINUX, Os.MINGW, Os.CYGWIN))
commandLine("cmd", "/c", "tasklist | find \"cmd.exe\"", os = setOf(Os.WINDOWS), fail = setOf(Fail.EXIT))
}
}