2
为什么提交消息中的空格导致p2
失败?当命令有空格时执行groovy进程的问题
def envp = null
def repoDir = File.createTempFile("test","txt").getParentFile()
Process p = "git init".execute(null, repoDir)
p.waitForProcessOutput(System.out, System.err)
/////////////
println "Commit1 start"
Process p1 = "git commit --allow-empty -m \"Commit1\"".execute(null, repoDir)
p1.waitForProcessOutput(System.out, System.err)
println "Commit1 done"
/////////////
println "Commit2 start"
Process p2 = "git commit --allow-empty -m \"Commit number 2\"".execute(null, repoDir)
p2.waitForProcessOutput(System.out, System.err)
println "Commit2 done"
你尝试过'''git commit --allow-empty -m'提交编号2'''?用单引号。 – dmahapatro
是的。试过也。没有工作。我在Mac Mavericks上 – DarVar