diff options
-rw-r--r-- | DOCS/man/ipc.rst | 5 | ||||
-rw-r--r-- | player/scripting.c | 8 |
2 files changed, 4 insertions, 9 deletions
diff --git a/DOCS/man/ipc.rst b/DOCS/man/ipc.rst index fdf5daf9b6..4b808b9ff9 100644 --- a/DOCS/man/ipc.rst +++ b/DOCS/man/ipc.rst @@ -380,11 +380,6 @@ shebang and have the executable bit set. When executed, a socket (the IPC connection) is passed to them through file descriptor inheritance. The file descriptor is indicated as the special command line argument ``--mpv-ipc-fd=N``, where ``N`` is the numeric file descriptor. -Currently, this is hardcoded as ``--mpv-ipc-fd=3``, and the intention is that -it will always be ``3``. (This was a compromise between keeping it as simple as -possible, and not doing too much implicitly. Also, since there is a chance that -this will change anyway, you should at least validate that you got the expected -argument.) The rest is the same as with a normal ``--input-ipc-server`` IPC connection. mpv does not attempt to observe or other interact with the started script process. diff --git a/player/scripting.c b/player/scripting.c index bb4c93b60e..7b3f9afb3c 100644 --- a/player/scripting.c +++ b/player/scripting.c @@ -335,8 +335,8 @@ static int load_run(struct mp_script_args *args) // Hardcode them (according to opts.fds[]), because we want to allow clients // to hardcode them if they want. Sue me. - char *fdopt = fds[1] >= 0 ? "--mpv-ipc-fd=3:4" - : "--mpv-ipc-fd=3"; + char *fdopt = fds[1] >= 0 ? mp_tprintf(80, "--mpv-ipc-fd=%d:%d", fds[0], fds[1]) + : mp_tprintf(80, "--mpv-ipc-fd=%d", fds[0]); struct mp_subprocess_opts opts = { .exe = (char *)args->filename, @@ -348,8 +348,8 @@ static int load_run(struct mp_script_args *args) {.fd = 2, .src_fd = 2,}, // Just hope these don't step over each other (e.g. fds[1] is not // below 4, if the std FDs are missing). - {.fd = 3, .src_fd = fds[0], }, - {.fd = 4, .src_fd = fds[1], }, + {.fd = fds[0], .src_fd = fds[0], }, + {.fd = fds[1], .src_fd = fds[1], }, }, .num_fds = fds[1] >= 0 ? 5 : 4, .detach = true, |