summaryrefslogtreecommitdiffstats
path: root/DOCS
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-07-17 01:34:46 +0200
committerwm4 <wm4@nowhere>2020-07-20 21:02:17 +0200
commit0279a44d93a378fbdff393d6568a691817f83518 (patch)
treee81a2984f7d71cccb871f43c2c6e25c652548834 /DOCS
parentc9742413ac5eeabfdd46503f67b7393c9bd99f49 (diff)
downloadmpv-0279a44d93a378fbdff393d6568a691817f83518.tar.bz2
mpv-0279a44d93a378fbdff393d6568a691817f83518.tar.xz
command: extend subprocess command
Add env and detach arguments. This means the command.c code must use the "new" mp_subprocess2(). So also take this as an opportunity to clean up. win32 support gets broken by it, because it never made the switch to the newer function. The new detach parameter makes the "run" command fully redundant, but I guess we'll keep it for simplicity. But change its implementation to use mp_subprocess2() (couldn't do this earlier, because win32). Privately, I'm going to use the "env" argument to add a key binding that starts a shell with a FILE environment variable set to the currently playing file, so this is very useful to me. Note: breaks windows, so for example youtube-dl on windows will not work anymore. mp_subprocess2() has to be implemented. The old functions are gone, and subprocess-win.c is not built anymore. It will probably work on Cygwin.
Diffstat (limited to 'DOCS')
-rw-r--r--DOCS/man/input.rst18
1 files changed, 17 insertions, 1 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index cd587072d8..cf1bb5b4e9 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -523,12 +523,28 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_).
``capture_stderr`` (``MPV_FORMAT_FLAG``)
Same as ``capture_stdout``, but for stderr.
+ ``detach`` (``MPV_FORMAT_FLAG``)
+ Whether to run the process in detached mode (optional, default: no). In
+ this mode, the process is run in a new process session, and the command
+ does not wait for the process to terminate. If neither
+ ``capture_stdout`` nor ``capture_stderr`` have been set to ``yes``,
+ the command returns immediately after the new process has been started,
+ otherwise the command will read as long as the pipes are open.
+
+ ``env`` (``MPV_FORMAT_NODE_ARRAY[MPV_FORMAT_STRING]``)
+ Set a list of environment variables for the new process (default: empty).
+ If an empty list is passed, the environment of the mpv process is used
+ instead. (Unlike the underlying OS mechanisms, the mpv command cannot
+ start a process with empty environment. Fortunately, that is completely
+ useless.) The format of the list is as in the ``execle()`` syscall. Each
+ string item defines an environment variable as in ``NANME=VALUE``.
+
The command returns the following result (as ``MPV_FORMAT_NODE_MAP``):
``status`` (``MPV_FORMAT_INT64``)
The raw exit status of the process. It will be negative on error. The
meaning of negative values is undefined, other than meaning error (and
- does not necessarily correspond to OS low level exit status values).
+ does not correspond to OS low level exit status values).
On Windows, it can happen that a negative return value is returned
even if the process exits gracefully, because the win32 ``UINT`` exit