subprocess.check_output('lspci | egrep -i "virtio network" | wc -l', shell=True)
失败,退出状态为-15。发生这种情况的可能情况是什么?
CalledProcessError: Command 'lspci | egrep -i "virtio network" | wc -l' returned non-zero exit status -15
我了解了退出状态1,但是代码-15的具体含义是什么。
答案 0 :(得分:0)
如果子进程在收到INT
(即dat[dat[, c("gr", "date", "end_date") :=
c(.(.I), lapply(.SD[,4:5], as.Date, format= '%d/%m/%Y'))][,
seq(date, as.Date(ifelse(is.na(end_date), date,end_date), '1970-01-01'),
'quarter'), gr ],on='gr']
id boro block date end_date gr V1
1: 1 1 1 1991-01-01 1992-01-01 1 1991-01-01
2: 1 1 1 1991-01-01 1992-01-01 1 1991-04-01
3: 1 1 1 1991-01-01 1992-01-01 1 1991-07-01
4: 1 1 1 1991-01-01 1992-01-01 1 1991-10-01
5: 1 1 1 1991-01-01 1992-01-01 1 1992-01-01
6: 1 1 2 1991-01-01 1992-01-01 2 1991-01-01
7: 1 1 2 1991-01-01 1992-01-01 2 1991-04-01
8: 1 1 2 1991-01-01 1992-01-01 2 1991-07-01
9: 1 1 2 1991-01-01 1992-01-01 2 1991-10-01
10: 1 1 2 1991-01-01 1992-01-01 2 1992-01-01
11: 1 2 3 1991-01-01 1992-01-01 3 1991-01-01
12: 1 2 3 1991-01-01 1992-01-01 3 1991-04-01
13: 1 2 3 1991-01-01 1992-01-01 3 1991-07-01
14: 1 2 3 1991-01-01 1992-01-01 3 1991-10-01
15: 1 2 3 1991-01-01 1992-01-01 3 1992-01-01
16: 1 2 4 1991-01-01 <NA> 4 1991-01-01
17: 2 1 1 1992-01-01 1993-01-01 5 1992-01-01
18: 2 1 1 1992-01-01 1993-01-01 5 1992-04-01
19: 2 1 1 1992-01-01 1993-01-01 5 1992-07-01
20: 2 1 1 1992-01-01 1993-01-01 5 1992-10-01
21: 2 1 1 1992-01-01 1993-01-01 5 1993-01-01
22: 2 1 2 1992-01-01 1993-01-01 6 1992-01-01
23: 2 1 2 1992-01-01 1993-01-01 6 1992-04-01
24: 2 1 2 1992-01-01 1993-01-01 6 1992-07-01
25: 2 1 2 1992-01-01 1993-01-01 6 1992-10-01
26: 2 1 2 1992-01-01 1993-01-01 6 1993-01-01
27: 2 2 3 1992-01-01 <NA> 7 1992-01-01
28: 2 2 5 1992-01-01 <NA> 8 1992-01-01
29: 3 1 1 1993-01-01 <NA> 9 1993-01-01
30: 3 1 2 1993-01-01 <NA> 10 1993-01-01
31: 3 2 6 1993-01-01 <NA> 11 1993-01-01
32: 3 2 7 1993-01-01 <NA> 12 1993-01-01
id boro block date end_date gr V1
)后死亡,您将在python 2中看到这一点。既然您使用过SIGTERM
,这意味着15
包裹电话的过程被shell=True
(接收到的信号)杀死(并终止)。
在这种情况下,Python 3的输出对于提示原因可能会更有用:
/bin/sh
查看您的电话:
SIGTERM
也许尝试一下是可行的:
subprocess.CalledProcessError: Command 'lspci | egrep -i "virtio network" | wc -l' died with <Signals.SIGTERM: 15>.
它不是将调用包装在shell实例中并分叉多个进程以获取具有特定字符串的行数,而是从subprocess.check_output('lspci | egrep -i "virtio network" | wc -l', shell=True)
检索输出,将其转换为小写(使匹配不区分大小写,例如{{ 1}}),并在行边界上分割输出。基于这些行的列表的列表理解为我们提供了所有行的结果列表,所有行限于包含搜索到的len([l for l
in subprocess.check_output('lspci').lower().splitlines()
if b"virtio network" in l])
(或者lspci
为py2 / 3友好)和-i
给了我们str
的行数。