(line: string, appBundleId: string)
| 155 | } |
| 156 | |
| 157 | function extractAndroidPidsFromPackageLine(line: string, appBundleId: string): string[] { |
| 158 | const escapedPackage = escapeRegExp(appBundleId); |
| 159 | const patterns = [ |
| 160 | new RegExp(`\\bStart proc\\s+(\\d+):${escapedPackage}(?:\\b|/)`, 'i'), |
| 161 | new RegExp(`\\b(\\d+):${escapedPackage}(?:\\b|/)`, 'i'), |
| 162 | new RegExp(`${escapedPackage}.*?\\bpid\\s*[=:]?\\s*(\\d+)\\b`, 'i'), |
| 163 | new RegExp(`\\bpid\\s*[=:]?\\s*(\\d+)\\b.*${escapedPackage}`, 'i'), |
| 164 | ]; |
| 165 | const results: string[] = []; |
| 166 | for (const pattern of patterns) { |
| 167 | const match = pattern.exec(line); |
| 168 | const pid = match?.[1]; |
| 169 | if (pid && /^\d+$/.test(pid)) { |
| 170 | results.push(pid); |
| 171 | } |
| 172 | } |
| 173 | return results; |
| 174 | } |
| 175 | |
| 176 | function filterAndroidLogcatToPids(content: string, appBundleId: string, pids: string[]): string { |
| 177 | const pidSet = new Set(pids); |
no test coverage detected