Created
April 26, 2013 06:09
-
-
Save katta/5465317 to your computer and use it in GitHub Desktop.
Groovy shell command
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
def command = "git --version" | |
def proc = command.execute() | |
proc.waitFor() | |
println "Process exit code: ${proc.exitValue()}" | |
println "Std Err: ${proc.err.text}" | |
println "Std Out: ${proc.in.text}" |
Thanks for the script 👍
thanks for the script again :)
with git working dir:
String command = "git log -1"
def proc = command.execute( null, new File("/path/to/folder") )
proc.waitFor()
println """
${proc.err.text ?: ''}
${proc.in.text ?: ''}
Process exit code: ${proc.exitValue()}
"""
or with system environment
List env = System.getenv().collect { k, v -> "${k}=${v}" }
String command = "git log -1"
def proc = command.execute( env, new File("/path/to/folder") )
proc.waitFor()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank for the commands