()
| 318 | } |
| 319 | |
| 320 | export async function killFlutterTester(): Promise<void> { |
| 321 | // privateApi may be unavailable if the test was skipped (eg. Flutter Bazel on |
| 322 | // Windows), so we can't call privateApi.safeToolSpawn here (though also should |
| 323 | // not need to). |
| 324 | if (!privateApi) |
| 325 | return; |
| 326 | |
| 327 | await new Promise<void>((resolve) => { |
| 328 | const proc = isWin |
| 329 | ? privateApi.safeToolSpawn(undefined, "taskkill", ["/IM", "flutter_tester.exe", "/F"]) |
| 330 | : privateApi.safeToolSpawn(undefined, "pkill", ["flutter_tester"]); |
| 331 | proc.on("exit", (code: number) => { |
| 332 | if (isWin ? code !== 128 : code === 0) { |
| 333 | logger.warn(`flutter_tester process(s) remained after test (${currentTestName}). These have been terminated to avoid affecting future tests, ` + |
| 334 | `but may indicate something is not cleaning up correctly`, LogCategory.CI); |
| 335 | } |
| 336 | resolve(); |
| 337 | }); |
| 338 | }); |
| 339 | |
| 340 | if (!isWin) { |
| 341 | await new Promise<void>((resolve) => { |
| 342 | const proc2 = privateApi.safeToolSpawn(undefined, "ps", ["-x"]); |
| 343 | |
| 344 | proc2.stdout.setEncoding("utf8"); |
| 345 | proc2.stdout.on("data", (data: Buffer | string) => logger.info(data.toString())); |
| 346 | proc2.stderr.setEncoding("utf8"); |
| 347 | proc2.stderr.on("data", (data: Buffer | string) => logger.info(data.toString())); |
| 348 | proc2.on("error", (error) => logger.info(error?.message)); |
| 349 | proc2.on("data", (data: Buffer | string) => logger.info(data.toString())); |
| 350 | |
| 351 | proc2.on("exit", () => resolve()); |
| 352 | }); |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | export function isSdkFrame(frame: DebugProtocol.StackFrame) { |
| 357 | return frame.source?.name?.startsWith("dart:"); |
no test coverage detected