MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / spawnFlutterProcess

Function spawnFlutterProcess

src/test/debug_helpers.ts:276–298  ·  view source on GitHub ↗
(script: string | Uri)

Source from the content-addressed store, hash-verified

274}
275
276export 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
300class DartProcess {
301 public readonly vmServiceUri: Promise<string>;

Callers 1

Calls 4

getLaunchConfigurationFunction · 0.90
logProcessFunction · 0.90
deferFunction · 0.90
infoMethod · 0.65

Tested by

no test coverage detected