writeStdin method

  1. @override
void writeStdin(
  1. List<int> data
)
override

Writes data to the process's standard input.

Implementation

@override
void writeStdin(List<int> data) {
  if (isInvalidHandle(_conin) || data.isEmpty) return;
  final buf = calloc<Uint8>(data.length);
  final written = calloc<Uint32>();
  try {
    buf.asTypedList(data.length).setAll(0, data);
    _k.writeFile(_conin, buf, data.length, written, nullptr);
  } catch (_) {
    // The child may have exited and the pipe closed.
  } finally {
    calloc.free(buf);
    calloc.free(written);
  }
}