我正在尝试在Groovy中执行git shell命令。第一个命令可以成功执行,但第二个命令返回退出码128:
def workingDir = new File("path/to/dir")
"git add .".execute(null, workingDir)
def p = "git reset --hard".execute( null, workingDir )
p.text.eachLine {println it}
println p.exitValue()
这段代码存在什么问题?
def p
行之后添加p.consumeProcessOutput(System.out, System.err)
这一行,会打印什么内容? - tim_yates"git add .".execute(null, workingDir)
应该改为"git add .".execute(null, workingDir).waitFor()
。 - tim_yates