configure method

  1. @override
Step configure()
override

Implementation

@override
Step configure() => Runnable(name: name, description: description, (
  context,
) async {
  final process = await getProcess();

  final List<Future<void>> futures = [];
  process.stdout.listen((chars) {
    if (onStdout != null) {
      futures.add(Future.value(onStdout!(chars, context)));
    }
  });

  String fullStderr = "";
  process.stderr.listen((chars) {
    if (onStderr != null) {
      futures.add(Future.value(onStderr!(chars, context)));
    }
    fullStderr += "\n${String.fromCharCodes(chars)}";
  });

  await process.exitCode;
  await Future.wait(futures);

  if (runAsAdministrator && Platform.isWindows) {
    await _windowsWaitForPowershell();
  }

  if (fullStderr.isNotEmpty) {
    return Response(message: "An error occurred in the process: $fullStderr");
  }
  return Response(
    message: "Shell step executed without any issues.",
    level: ResponseLevel.status,
  );
});