Replaced popen usage with uniproc_process

This commit is contained in:
2025-03-06 17:54:53 +11:00
parent fe01a41aac
commit 667151b1b6
2 changed files with 106 additions and 113 deletions

View File

@@ -10,11 +10,11 @@
int luaopen_platform(lua_State* L);
// Returns the exit code of the command as well as a string of its stdout
// int, string function platform.exec(cmd: string, args: array<string>)
// int, string, string function platform.exec(cmd: string, args: array<string>)
int lua_platform_exec(lua_State* L);
// Executes a command asynchronosly, returning a promise to the functions return values
// promise<int>, promise<string> function platform.exec_async(cmd: string, args: array<string>)
// promise<int>, promise<string>, promise<string> function platform.exec_async(cmd: string, args: array<string>)
int lua_platform_exec_async(lua_State* L);
// Executes a command asynchronosly, calling a callback on its completion with its error code and
@@ -22,13 +22,14 @@ int lua_platform_exec_async(lua_State* L);
// function platform.exec_async_cb(cmd: string,
// function on_complete(cmd: string, exit_code: int, overall_output: string),
// function on_stdout(cmd: string, overall_output: string, delta_output: string)
// function on_stderr(cmd: string, overall_output: string, delta_output: string)
// )
int lua_platform_exec_async_cb(lua_State* L);
// Executes the same command up to N times in parallel, iterating through the args provided until all arguments have been used
// array[promise<int>, promise<string>] function platform.exec_parallel_async(cmd: string, N: int, args: array<array<string>>)
// array[promise<int>, promise<string>, promise<string>] function platform.exec_parallel_async(cmd: string, N: int, args: array<array<string>>)
int lua_platform_exec_parallel_async(lua_State* L);
// array<int>, array<string> function platform.exec_parallel(cmd: string, N: int, args: array<array<string>>)
// array<int>, array<string>, array<string> function platform.exec_parallel(cmd: string, N: int, args: array<array<string>>)
int lua_platform_exec_parallel(lua_State* L);