我无法使用python子进程任务从master获取最新的commit id。请注意以下详细信息。
脚本详情:
Application has thrown an uncaught exception and is terminated:
SyntaxError: missing ) after argument list
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (D:\home\site\wwwroot\app.js:12:20)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
当我运行脚本时,我正在关注put,
输出:
Release_Commit_result= subprocess.check_output("git", "log", "-1", "--pretty=format:","%H")
TypeError:
init ()为
获取了多个值Release_Commit_result= subprocess.check_output("git", "log", "-1", "--pretty=format:","%H") File "/usr/lib/python2.7/subprocess.py", line 212, in check_output process = Popen(stdout=PIPE, *popenargs, **kwargs)
关键字参数&#39; stdout&#39;
这个git命令实际上是从git bash运行时的输出。
答案 0 :(得分:2)
执行命令,在数组或单个字符串中提供参数。像这样:
subprocess.check_output(["git", "log", "-1", "--pretty-format:%H"])
请参阅https://docs.python.org/2/library/subprocess.html作为参考。
<强>更新强> 根据博士的建议编辑命令,在评论中。