这种情况的正确代码是什么:
p = subprocess.Popen(["git", "log" , "-1", "--pretty=format:\'%s %n%n%b\'", hash],
stdout=subprocess.PIPE)
out, err = p.communicate()
print out
message += '\n' + out
Run Code Online (Sandbox Code Playgroud)
我总是得到这个错误:
fatal: ambiguous argument '': unknown revision or path not in the working tree.
output: Use '--' to separate paths from revisions
Run Code Online (Sandbox Code Playgroud)
而我在工作树上.
由于shell不解析调用,因此根本不需要引号:
p = subprocess.Popen(
["git", "log" , "-1", "--pretty=format:%s %n%n%b", hash],
stdout=subprocess.PIPE)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
197 次 |
| 最近记录: |