小编pau*_*ulo的帖子

退出状态为 128 的子进程调用

本质上,我试图使用子进程调用来签出特定 sha 哈希处的 git 提交。

但是,我不断收到错误subprocess.CalledProcessError: Command '['git', 'checkout', '62bbce43e']' returned non-zero exit status 128.

这是我的代码如下:

with open(filename) as inputfile:
    reader = csv.reader(inputfile, delimiter=",")
    linecount = 0
    for row in reader:
        if linecount == 0:
            linecount += 1
        else:
            repo = str(row[0])
            sha = str(row[2])
            specificfile = str(row[3])
            linenum = int(row[4])
            cl("cd", repo)
            subprocess.check_output(['git', 'checkout', sha])
            print("checkout done")
            git("checkout", "-")
Run Code Online (Sandbox Code Playgroud)

python git subprocess

12
推荐指数
1
解决办法
4万
查看次数

标签 统计

git ×1

python ×1

subprocess ×1