MacAppStoreUpdateDetector: Add pid to the log

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2021-07-22 12:36:26 +05:30 committed by Jason A. Donenfeld
parent b74eb7239a
commit f5a14b8434
1 changed files with 2 additions and 1 deletions

View File

@ -8,8 +8,9 @@ class MacAppStoreUpdateDetector {
guard isQuitEvent(quitAppleEvent) else { return false } guard isQuitEvent(quitAppleEvent) else { return false }
guard let senderPIDDescriptor = quitAppleEvent.attributeDescriptor(forKeyword: keySenderPIDAttr) else { return false } guard let senderPIDDescriptor = quitAppleEvent.attributeDescriptor(forKeyword: keySenderPIDAttr) else { return false }
let pid = senderPIDDescriptor.int32Value let pid = senderPIDDescriptor.int32Value
wg_log(.debug, message: "aevt/quit Apple event received from pid: \(pid)")
guard let executablePath = getExecutablePath(from: pid) else { return false } guard let executablePath = getExecutablePath(from: pid) else { return false }
wg_log(.debug, message: "aevt/quit Apple event received from: \(executablePath)") wg_log(.debug, message: "aevt/quit Apple event received from executable: \(executablePath)")
if executablePath.hasPrefix("/System/Library/") { if executablePath.hasPrefix("/System/Library/") {
let executableName = URL(fileURLWithPath: executablePath, isDirectory: false).lastPathComponent let executableName = URL(fileURLWithPath: executablePath, isDirectory: false).lastPathComponent
return executableName == "com.apple.CommerceKit.StoreAEService" return executableName == "com.apple.CommerceKit.StoreAEService"