(script: string | Uri)
| 274 | } |
| 275 | |
| 276 | export async function spawnFlutterProcess(script: string | Uri): Promise<DartProcess> { |
| 277 | const config = await getLaunchConfiguration(script, { deviceId: "flutter-tester" }); |
| 278 | if (!config) |
| 279 | throw new Error(`Could not get launch configuration (got ${config})`); |
| 280 | const binPath = path.join(config.flutterSdkPath!, flutterPath); |
| 281 | const args = [ |
| 282 | "run", |
| 283 | "-d", |
| 284 | config.deviceId as string, |
| 285 | "--start-paused", |
| 286 | ]; |
| 287 | const process = privateApi.safeToolSpawn(config.cwd, binPath, args); |
| 288 | logger.info(`(PROC ${process.pid}) Spawned ${binPath} ${args.join(" ")} in ${config.cwd}`, LogCategory.CommandProcesses); |
| 289 | logProcess(logger, LogCategory.CI, process); |
| 290 | const flutterProcess = new DartProcess(process); |
| 291 | defer("Kill spawned Flutter process", () => { |
| 292 | // TODO: This may not be terminating correctly, as it may terminate the |
| 293 | // shell process and not the child processes. |
| 294 | if (!flutterProcess.hasExited) |
| 295 | flutterProcess.process.kill(); |
| 296 | }); |
| 297 | return flutterProcess; |
| 298 | } |
| 299 | |
| 300 | class DartProcess { |
| 301 | public readonly vmServiceUri: Promise<string>; |
no test coverage detected