Created
January 24, 2013 00:29
-
-
Save xconnecting/4616290 to your computer and use it in GitHub Desktop.
Gradle: Get standard output text
This file contains 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
ant.condition(property: "os", value: "windows") { os(family: "windows") } | |
ant.condition(property: "os", value: "unix" ) { os(family: "unix") } | |
task execCommandLine(type:Exec) { | |
switch(ant.properties.os){ | |
case 'windows': | |
commandLine 'cmd', '/c', 'echo', 'hello' | |
break | |
case 'unix': | |
commandLine 'echo', 'hello' | |
break | |
} | |
standardOutput = new ByteArrayOutputStream() | |
} | |
execCommandLine.doFirst { | |
println 'doFirst' | |
print standardOutput.toString() | |
} | |
execCommandLine << { | |
println 'doLast' | |
print standardOutput.toString() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment