April 26th, 2008
groovy의 String.execute()

groovy

groovy는 언어의 문법적인 특징 외에도 java API를 조금 확장(Groovy JDK)하던데
String에 execute() 라는 메소드가 있다.

def process = "ls -l".execute()
println “Found text ${process.text}”

코드 출처 : Korea Input Output

특정 이름의 system property를 읽어오는 Boolean.getBoolean() 과 더불어 다소 엉뚱한 곳에 있다고 생각되지만 실용적이라 맘에 든다.