native_execvp function

int native_execvp(
  1. String file,
  2. Pointer<Pointer<Utf8>> __argv
)

Execute FILE, searching in the PATH' environment variable if it contains no slashes, with arguments ARGV and environment from environ'.

Implementation

int native_execvp(
  String file, // ffi.Pointer<Utf8> file,
  ffi.Pointer<ffi.Pointer<Utf8>> __argv,
) {
  final cFile = file.toNativeUtf8();

  _execvp ??= Libc().dylib.lookupFunction<
      ffi.Int32 Function(ffi.Pointer<Utf8>, ffi.Pointer<ffi.Pointer<Utf8>>),
      _dart_execvp>('execvp');
  final result = _execvp!(
    cFile,
    __argv,
  );

  malloc.free(cFile);

  return result;
}