stop method

  1. @override
Future<String> stop()
override

Implementation

@override
Future<String> stop() async {
  await runBounded(_adbPath, stopArgs(_serial),
      timeout: const Duration(seconds: 10), phase: 'adb stopping screenrecord');
  try {
    await _process.exitCode.timeout(const Duration(seconds: 10));
  } on TimeoutException {
    _process.kill(ProcessSignal.sigkill);
  }
  final pull = await runBounded(_adbPath, pullArgs(_serial, path),
      timeout: const Duration(seconds: 60), phase: 'adb pulling the recording');
  await runBounded(_adbPath, removeArgs(_serial),
      timeout: const Duration(seconds: 10), phase: 'adb removing the recording');
  if (pull.exitCode != 0 || !File(path).existsSync()) {
    throw BackendToolError(
      backend: 'adb($_serial)',
      command: 'adb pull',
      exitCode: pull.exitCode,
      stderr: (pull.stderr as String?)?.trim() ?? 'pull failed',
    );
  }
  return path;
}