fix: continue released verify batches and bound automation shutdown
This commit is contained in:
1 parent
477a5a46e3
commit
00db1cf5f2
23 files changed
+550
-115
No files matched your search
@@ -31,7 +31,8 @@ def query_owners(names, *, timeout_seconds=10):
|
||||
raise ValueError('invalid result')
|
||||
for row in rows:
|
||||
if (type(row['pid']) is not int or row['pid'] <= 0 or row['name'].casefold() not in {n.casefold() for n in names}
|
||||
or not isinstance(row['command'], str)):
|
||||
or not isinstance(row['command'], str) or not isinstance(row['executable'], str)
|
||||
or type(row['parent']) is not int or row['parent'] < 0):
|
||||
raise ValueError('invalid owner')
|
||||
return rows
|
||||
except (OSError, ValueError, KeyError, TypeError, AttributeError) as error:
|
||||
@@ -48,10 +49,11 @@ def owner_probe_main(job):
|
||||
pythoncom.CoInitialize()
|
||||
try:
|
||||
service = win32com.client.GetObject('winmgmts:')
|
||||
query = 'SELECT ProcessId,Name,CommandLine FROM Win32_Process WHERE ' + ' OR '.join(
|
||||
query = 'SELECT ProcessId,Name,CommandLine,ExecutablePath,ParentProcessId FROM Win32_Process WHERE ' + ' OR '.join(
|
||||
f"Name='{name}'" for name in names)
|
||||
rows = [{'pid': int(item.ProcessId), 'name': str(item.Name),
|
||||
'command': str(item.CommandLine or '')} for item in service.ExecQuery(query)]
|
||||
'command': str(item.CommandLine or ''), 'executable': str(item.ExecutablePath or ''),
|
||||
'parent': int(item.ParentProcessId or 0)} for item in service.ExecQuery(query)]
|
||||
service = None
|
||||
job.with_name('result.json').write_text(json.dumps({'names': names, 'owners': rows}), encoding='utf-8')
|
||||
return 0
|
||||
|
||||
Reference in new issue
Block a user