防止编译失败时脚本无法退出
This commit is contained in:
7
make.py
7
make.py
@@ -144,11 +144,14 @@ def run_cmd_queue(cmd_queue:Queue,cpu_num:int=cpu_count()):
|
|||||||
process_list.append(p)
|
process_list.append(p)
|
||||||
for i in process_list:
|
for i in process_list:
|
||||||
i.join()
|
i.join()
|
||||||
|
# 消耗掉所有数据防止进程无法退出
|
||||||
|
while not cmd_queue.empty():
|
||||||
|
cmd_queue.get()
|
||||||
while not return_list.empty():
|
while not return_list.empty():
|
||||||
i=return_list.get()
|
i=return_list.get()
|
||||||
if(not i[1]):
|
if(not i[1]):
|
||||||
print(f"子进程 [{i[0]}] 运行失败")
|
print(f"子进程 [{i[0]}] 运行失败")
|
||||||
exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
|
|
||||||
# 保证目标都存在
|
# 保证目标都存在
|
||||||
@@ -207,7 +210,7 @@ def build_target(src:list):
|
|||||||
print(f"链接 {dst}")
|
print(f"链接 {dst}")
|
||||||
ret=os.system(cmd)
|
ret=os.system(cmd)
|
||||||
if(ret):
|
if(ret):
|
||||||
exit()
|
sys.exit(-1)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@@ -159,11 +159,14 @@ def run_cmd_queue(cmd_queue:Queue,cpu_num:int=cpu_count()):
|
|||||||
process_list.append(p)
|
process_list.append(p)
|
||||||
for i in process_list:
|
for i in process_list:
|
||||||
i.join()
|
i.join()
|
||||||
|
# 消耗掉所有数据防止进程无法退出
|
||||||
|
while not cmd_queue.empty():
|
||||||
|
cmd_queue.get()
|
||||||
while not return_list.empty():
|
while not return_list.empty():
|
||||||
i=return_list.get()
|
i=return_list.get()
|
||||||
if(not i[1]):
|
if(not i[1]):
|
||||||
print(f"子进程 [{i[0]}] 运行失败")
|
print(f"子进程 [{i[0]}] 运行失败")
|
||||||
exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
|
|
||||||
# 保证目标都存在
|
# 保证目标都存在
|
||||||
@@ -226,7 +229,7 @@ def build_target(src:list):
|
|||||||
print(f"链接 {dst}")
|
print(f"链接 {dst}")
|
||||||
ret=os.system(cmd)
|
ret=os.system(cmd)
|
||||||
if(ret):
|
if(ret):
|
||||||
exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user