Commit 834bfd08 by 文周繁

fix: 修复部分程序无法用utf-8解码和asan程序未上传时报错的问题

parent ee44c51b
......@@ -50,7 +50,7 @@ def exec_command(crashes_collection, usage, command, seed_id: ObjectId):
error_cause = ''
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
_, errs = process.communicate()
errs = str(errs, "utf-8")
errs = str(errs, "utf-8", errors='ignore')
if usage == "valgrind":
err_data = ''
search_at_count = 0
......@@ -152,16 +152,17 @@ def main(argv):
fs = GridFS(default_db, fs_name)
# 根据ObjectId查找文件
print(software["asan_file"])
asan_file_data = fs.get(software["asan_file"])
if asan_file_data:
# 确保下载目录存在
os.makedirs(os.path.dirname(asan_file_path), exist_ok=True)
# 读取文件内容并保存到本地
with open(asan_file_path, "wb") as f:
f.write(asan_file_data.read())
os.system(f"chmod +x {asan_file_path}")
print("asan_file download successfully")
generation_command(crashes_collection, asan_file_path, parameter, crashes_file_paths, "")
if software["asan_file"] is not None:
asan_file_data = fs.get(software["asan_file"])
if asan_file_data:
# 确保下载目录存在
os.makedirs(os.path.dirname(asan_file_path), exist_ok=True)
# 读取文件内容并保存到本地
with open(asan_file_path, "wb") as f:
f.write(asan_file_data.read())
os.system(f"chmod +x {asan_file_path}")
print("asan_file download successfully")
generation_command(crashes_collection, asan_file_path, parameter, crashes_file_paths, "")
finally:
task_collection.update_one({"_id": ObjectId(task_id)}, {"$set": {"verification": "VERIFIED"}})
host_node = host_node_collection.find_one({"_id": ObjectId(host_node_id)})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment