engineProbe static method

Future<String> engineProbe()

Verifies the resolved qjs binary by running <bin> -e 'print(1)' and returns a version string (<bin> -v, falling back to the binary path). Throws ExtEngineUnavailableException when the binary is missing or broken. Used by fa ext list.

Implementation

static Future<String> engineProbe() async {
  final bin = resolveBinary();
  final ProcessResult probe;
  try {
    probe = await _run(bin, const ['-e', 'print(1)']);
  } on Object {
    throw ExtEngineUnavailableException(_installHint);
  }
  final problem = extProbeProblem(
    bin,
    probe.exitCode,
    probe.stdout,
    probe.stderr,
  );
  if (problem != null) throw ExtEngineUnavailableException(problem);
  return await _engineVersion(bin) ?? bin;
}