Search
Calendar
June 2025
S M T W T F S
« May    
1234567
891011121314
15161718192021
22232425262728
2930  
Archives

PostHeaderIcon How to call external shell in Groovy?

Going on learning Groovy, I faced the following case: how to call an external shell (or MS-DOS) command from a Groovy script?

It is very easy. The following example show how to display the Subversion status of the current folder:

def proc = "svn st"
def sb = new StringBuffer()
proc.consumeProcessErrorStream(sb)

println proc.text + "\n" +  sb.toString()

Leave a Reply