25 const char* error_msg,
27 static constexpr intptr_t kMaxArgumentListLength = 1024 * 1024;
34 if ((
len < 0) || (
len > kMaxArgumentListLength)) {
38 "Max argument list length exceeded");
46 for (
int i = 0;
i <
len;
i++) {
78 intptr_t process_stdin;
79 intptr_t process_stdout;
80 intptr_t process_stderr;
95 status_handle,
"_errorMessage",
96 "Starting new processes is not supported on iOS");
109 "Path must be a builtin string");
116 intptr_t args_length = 0;
119 "Arguments must be builtin strings", &args_length);
120 if (string_args ==
nullptr) {
126 const char* working_directory =
nullptr;
129 }
else if (!
Dart_IsNull(working_directory_handle)) {
134 "WorkingDirectory must be a builtin string");
140 intptr_t environment_length = 0;
141 char** string_environment =
nullptr;
145 "Environment values must be builtin strings", &environment_length);
146 if (string_environment ==
nullptr) {
158 char* os_error_message =
nullptr;
161 namespc,
path, string_args, args_length, working_directory,
162 string_environment, environment_length,
164 &process_stderr, &pid, &exit_event, &os_error_message);
165 if (error_code == 0) {
184 const char* error_message = (os_error_message !=
nullptr)
186 :
"Failed to get error message";
190 const intptr_t
len = strlen(error_message);
191 char* ascii_message =
193 for (intptr_t
i = 0;
i <
len;
i++) {
194 if (
static_cast<uint8_t
>(error_message[
i]) < 0x80) {
195 ascii_message[
i] = error_message[
i];
197 ascii_message[
i] =
'?';
200 ascii_message[
len] =
'\0';
203 "Failed to start %s. OS returned an error (code %d) which can't be "
204 "fully converted to Dart string (%s): %s",
228 process_stderr->
fd(), exit_event->
fd(), &
result);
285 int64_t milliseconds = 0;
330 intptr_t bytes_length = 0;
335 buffer[bytes_length] =
'\0';
340 if (str ==
nullptr) {
342 "SystemEncodingToString not supported on this operating system"));
357 const char* system_string =
359 if (system_string ==
nullptr) {
361 "StringToSystemEncoding not supported on this operating system"));
363 uint8_t*
buffer =
nullptr;
370 memmove(
buffer, system_string, system_len);
377 if (current_rss < 0) {
394 ASSERT(max_rss !=
nullptr);
395 ASSERT(current_rss !=
nullptr);
#define FUNCTION_NAME(name)
static int64_t GetInt64ValueCheckRange(Dart_Handle value_obj, int64_t lower, int64_t upper)
static Dart_Handle NewDartOSError()
static bool GetInt64Value(Dart_Handle value_obj, int64_t *value)
static const char * GetStringValue(Dart_Handle str_obj)
static Dart_Handle NewStringFormatted(const char *format,...)
static Dart_Handle NewDartUnsupportedError(const char *message)
static Dart_Handle NewString(const char *str)
static Dart_Handle SetIntegerField(Dart_Handle handle, const char *name, int64_t val)
static Dart_Handle SetStringField(Dart_Handle handle, const char *name, const char *val)
static intptr_t GetIntptrValue(Dart_Handle value_obj)
static Dart_Handle Allocate(intptr_t size, uint8_t **buffer)
static Namespace * GetNamespace(Dart_NativeArguments args, intptr_t index)
static bool ModeIsAttached(ProcessStartMode mode)
static void ClearSignalHandler(intptr_t signal, Dart_Port port)
static void SetGlobalExitCode(int exit_code)
static bool ModeHasStdio(ProcessStartMode mode)
static Dart_Handle GetProcessIdNativeField(Dart_Handle process, intptr_t *pid)
static int64_t CurrentRSS()
static void GetRSSInformation(int64_t *max_rss, int64_t *current_rss)
static intptr_t CurrentProcessId()
static int GlobalExitCode()
static bool Wait(intptr_t id, intptr_t in, intptr_t out, intptr_t err, intptr_t exit_handler, ProcessResult *result)
static bool Kill(intptr_t id, int signal)
static intptr_t SetSignalHandler(intptr_t signal)
static Dart_Handle SetProcessIdNativeField(Dart_Handle process, intptr_t pid)
static void ClearAllSignalHandlers()
static void RunExitHook(int64_t exit_code)
static int Start(Namespace *namespc, const char *path, char *arguments[], intptr_t arguments_length, const char *working_directory, char *environment[], intptr_t environment_length, ProcessStartMode mode, intptr_t *in, intptr_t *out, intptr_t *err, intptr_t *id, intptr_t *exit_handler, char **os_error_message)
static void SetSocketIdNativeField(Dart_Handle handle, intptr_t id, SocketFinalizer finalizer)
static Socket * GetSocketIdNativeField(Dart_Handle socket)
static const char * Utf8ToConsoleString(const char *utf8, intptr_t len=-1, intptr_t *result_len=nullptr)
static const char * ConsoleStringToUtf8(const char *str, intptr_t len=-1, intptr_t *result_len=nullptr)
static void Sleep(int64_t millis)
struct _Dart_Handle * Dart_Handle
struct _Dart_NativeArguments * Dart_NativeArguments
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
const uint8_t uint32_t uint32_t GError ** error
void FUNCTION_NAME() Process_SetExitCode(Dart_NativeArguments args)
void FUNCTION_NAME() Process_Pid(Dart_NativeArguments args)
static Dart_Handle ThrowIfError(Dart_Handle handle)
void FUNCTION_NAME() ProcessInfo_CurrentRSS(Dart_NativeArguments args)
static char ** ExtractCStringList(Dart_Handle strings, Dart_Handle status_handle, const char *error_msg, intptr_t *length)
void FUNCTION_NAME() Process_GetExitCode(Dart_NativeArguments args)
void FUNCTION_NAME() Process_Start(Dart_NativeArguments args)
void FUNCTION_NAME() Process_Sleep(Dart_NativeArguments args)
static constexpr int kProcessIdNativeField
void FUNCTION_NAME() Process_Wait(Dart_NativeArguments args)
void FUNCTION_NAME() ProcessInfo_MaxRSS(Dart_NativeArguments args)
void FUNCTION_NAME() Process_SetSignalHandler(Dart_NativeArguments args)
void FUNCTION_NAME() Process_KillPid(Dart_NativeArguments args)
void FUNCTION_NAME() SystemEncodingToString(Dart_NativeArguments args)
void FUNCTION_NAME() StringToSystemEncoding(Dart_NativeArguments args)
void FUNCTION_NAME() Process_Exit(Dart_NativeArguments args)
void FUNCTION_NAME() Process_ClearSignalHandler(Dart_NativeArguments args)
static dart::SimpleHashMap * environment
DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str, uint8_t **utf8_array, intptr_t *length)
DART_EXPORT Dart_Handle Dart_ListGetAt(Dart_Handle list, intptr_t index)
DART_EXPORT Dart_Port Dart_GetMainPortId()
DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj, int index, intptr_t *value)
DART_EXPORT void Dart_SetBooleanReturnValue(Dart_NativeArguments args, bool retval)
DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value)
DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t *utf8_array, intptr_t length)
DART_EXPORT const char * Dart_GetError(Dart_Handle handle)
DART_EXPORT uint8_t * Dart_ScopeAllocate(intptr_t size)
DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, Dart_Handle retval)
DART_EXPORT Dart_Handle Dart_ListSetAt(Dart_Handle list, intptr_t index, Dart_Handle value)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_SetNativeInstanceField(Dart_Handle obj, int index, intptr_t value)
DART_EXPORT void Dart_SetIntegerReturnValue(Dart_NativeArguments args, int64_t retval)
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
DART_EXPORT void Dart_ExitIsolate()
DART_EXPORT Dart_Handle Dart_SetField(Dart_Handle container, Dart_Handle name, Dart_Handle value)
DART_EXPORT Dart_Handle Dart_ListGetAsBytes(Dart_Handle list, intptr_t offset, uint8_t *native_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t *len)
DART_EXPORT Dart_Handle Dart_NewList(intptr_t length)
DART_EXPORT bool Dart_IsList(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception)
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
DART_EXPORT bool Dart_IsString(Dart_Handle object)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
static void process(const char *inPath, const char *lexer, const char *token, const char *hPath, const char *cppPath)