summaryrefslogtreecommitdiffstats
path: root/player/lua.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-05-12 16:03:04 +0200
committerwm4 <wm4@nowhere>2018-05-24 19:56:34 +0200
commit7f91e2684e8600c45512e36f03aadff0b825a1b0 (patch)
treed17956db6ef353c99b6d4004df026c7288c638c1 /player/lua.c
parent548ef07864f3e1a40f731b2643f037435ceae46d (diff)
downloadmpv-7f91e2684e8600c45512e36f03aadff0b825a1b0.tar.bz2
mpv-7f91e2684e8600c45512e36f03aadff0b825a1b0.tar.xz
lua: reimplement mp.subprocess_detached() by invoking the "run" command
The "run" command is old. I'm not sure why the separate Lua implementation was added. But maybe it as because the "run" command used to be limited to a small number of arguments. This limit has been removed a while ago. In any case, the old implementation is not needed anymore.
Diffstat (limited to 'player/lua.c')
-rw-r--r--player/lua.c30
1 files changed, 0 insertions, 30 deletions
diff --git a/player/lua.c b/player/lua.c
index f3bc3e699b..d08aaa3b45 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -1187,35 +1187,6 @@ static int script_join_path(lua_State *L)
return 1;
}
-static int script_subprocess_detached(lua_State *L)
-{
- struct script_ctx *ctx = get_ctx(L);
- luaL_checktype(L, 1, LUA_TTABLE);
- void *tmp = mp_lua_PITA(L);
-
- lua_getfield(L, 1, "args"); // args
- int num_args = mp_lua_len(L, -1);
- char *args[256];
- if (num_args > MP_ARRAY_SIZE(args) - 1) // last needs to be NULL
- luaL_error(L, "too many arguments");
- if (num_args < 1)
- luaL_error(L, "program name missing");
- for (int n = 0; n < num_args; n++) {
- lua_pushinteger(L, n + 1); // args n
- lua_gettable(L, -2); // args arg
- args[n] = talloc_strdup(tmp, lua_tostring(L, -1));
- if (!args[n])
- luaL_error(L, "program arguments must be strings");
- lua_pop(L, 1); // args
- }
- args[num_args] = NULL;
- lua_pop(L, 1); // -
-
- mp_subprocess_detached(ctx->log, args);
- lua_pushnil(L);
- return 1;
-}
-
static int script_getpid(lua_State *L)
{
lua_pushnumber(L, mp_getpid());
@@ -1309,7 +1280,6 @@ static const struct fn_entry utils_fns[] = {
FN_ENTRY(file_info),
FN_ENTRY(split_path),
FN_ENTRY(join_path),
- FN_ENTRY(subprocess_detached),
FN_ENTRY(getpid),
FN_ENTRY(parse_json),
FN_ENTRY(format_json),