Description
c = "ls";
Runtime.getRuntime().exec(["ls"]);
println "success"
Runtime.getRuntime().exec(["${c}"]);
println "success"
This will print "success" once and then:
Caught: groovy.lang.GroovyRuntimeException: failed to invoke method: groovy.lang.MetaClass$2@1bd0dd4[name: exec params: [class java.lang.String] returns: class java.lang.Process owner: class java.lang.Runtime] on: java.lang.Runtime@d70d7a with arguments: [[ls]]reason: java.lang.IllegalArgumentException: argument type mismatch
We should treat GStrings universally as Strings when talking to Java ... its a tall order but this:
Runtime.getRuntime().exec(["${c}".toString()]);
is definitely not groovy.
Attachments
Issue Links
- is related to
-
GROOVY-885 Strings with $variable embedded are not of java.lang.String class
- Closed