From e27c523a10708b7265c33a4bae631663df4bb297 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 16 Aug 2020 02:54:44 +0200 Subject: command: extend subprocess command stdin, change behavior Make it possible to feed a string to stdin of a subprocess. Out of laziness, it can't be an arbitrary byte string. (Would require adding an option type that takes in a Lua byte string.) Do not set stdin of a subprocess to fd 0 (i.e. mpv's stdin) anymore, because it makes things more consistent. Enabling stdin didn't make too much sense in the first place, so this behavior change seems justifiable. win32 support missing. Fixes: #8003 --- DOCS/interface-changes.rst | 3 +++ DOCS/man/input.rst | 11 +++++++++++ 2 files changed, 14 insertions(+) (limited to 'DOCS') diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index e58c13216d..bad810bef0 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -74,6 +74,9 @@ Interface changes - undeprecate --video-sync=display-adrop - deprecate legacy auto profiles (profiles starting with "extension." and "protocol."). Use conditional auto profiles instead. + - the "subprocess" command does not connect spawned processes' stdin to + mpv's stdin anymore. Instead, stdin is connected to /dev/null by default. + To get the old behavior, set the "passthrough_stdin" argument to true. --- mpv 0.32.0 --- - change behavior when using legacy option syntax with options that start with two dashes (``--`` instead of a ``-``). Now, using the recommended diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 6213eb29fb..1be069306e 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -547,6 +547,17 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_). On Lua, you may use ``utils.get_env_list()`` to retrieve the current environment if you e.g. simply want to add a new variable. + ``stdin_data`` (``MPV_FORMAT_STRING``) + Feed the given string to the new process' stdin. Since this is a string, + you cannot pass arbitrary binary data. If the process terminates or + closes the pipe before all data is written, the remaining data is + silently discarded. Probably does not work on win32. + + ``passthrough_stdin`` (``MPV_FORMAT_FLAG``) + If enabled, wire the new process' stdin to mpv's stdin (default: no). + Before mpv 0.33.0, this argument did not exist, but the default was if + it was set to ``yes``. + The command returns the following result (as ``MPV_FORMAT_NODE_MAP``): ``status`` (``MPV_FORMAT_INT64``) -- cgit v1.2.3