run method
Runs bd <args>. Throws BdTimeoutException if the call exceeds
timeout (the implementation kills the process tree); never throws for a
non-zero exit — that is reported via BdResult.exitCode for the caller to
route through BdCommandFailed.fromOutput.
stdin, when provided, is written to the child's stdin and the stream is
closed (EOF). bd batch reads its line-oriented script this way — one
spawn, one Dolt transaction (ADR-0001 D4).
Implementation
@override
Future<BdResult> run(
List<String> args, {
Duration? timeout,
String? stdin,
}) async {
final sub = args.isNotEmpty ? args.first : '';
if (sub == 'create') {
_createGate = Completer<String>();
final id = await _createGate!.future;
return BdResult(
exitCode: 0,
stdout: '{"schema_version":1,"data":{"id":"$id"}}',
stderr: '',
);
}
final id = args.length >= 2 ? args[1] : '';
return BdResult(
exitCode: 0,
stdout: '{"schema_version":1,"data":{"id":"$id"}}',
stderr: '',
);
}