Hmm… this thread seems to suggest the input stream should be initialized in a doFirst. Eg:
task encodeZip(type: Exec) {
workingDir path_target_workspace
commandLine "zipcloak", "file.zip"
doFirst {
ByteArrayOutputStream bytes = new ByteArrayOutputStream()
PrintWriter out = new PrintWriter(bytes)
out.println("psw")
out.println("psw")
out.flush()
standardInput = new ByteArrayInputStream(bytes.toByteArray())
}
}