executeReplay method
Execute replay using the provided configuration.
Implementation
Future<void> executeReplay(ReplayHarnessConfig config) async {
if (config.error case final error?) {
usageException(error);
}
var prepared = await _prepare(config);
onReplayPrepared(prepared);
if (config.convertOnly) {
onReplayCompleted(prepared, 0);
return;
}
final customized = await customizeReplayScenario(
prepared.scenario,
prepared.scenarioPath,
);
if (customized != null) {
await customized.save(prepared.scenarioPath);
prepared = PreparedReplay(
selection: prepared.selection,
scenario: customized,
actionCount: customized.actions.length,
);
}
if (config.captureTrace) {
final traceOut = io.File(config.traceOut);
if (await traceOut.exists()) {
await traceOut.delete();
}
if (!await traceOut.parent.exists()) {
await traceOut.parent.create(recursive: true);
}
}
final childArgs = <String>[
'dart',
'run',
harnessEntrypointPath,
...buildAppSpecificReplayArgs(config, prepared.scenarioPath),
];
final env = customizeReplayEnvironment(config) ?? io.Platform.environment;
final process = await io.Process.start(
io.Platform.resolvedExecutable,
childArgs,
environment: env,
mode: io.ProcessStartMode.inheritStdio,
workingDirectory: io.Directory.current.path,
);
final exitCode = await _waitForExit(process, config.timeoutSeconds);
onReplayCompleted(
prepared,
exitCode,
tracePath: config.traceOut,
summaryCount: config.summaryCount,
);
if (exitCode != 0) {
io.exitCode = exitCode;
}
}