[MPlayer-cvslog] r35081 - in trunk: DOCS/tech/slave.txt command.c
reimar
subversion at mplayerhq.hu
Sun Aug 12 19:57:35 CEST 2012
Author: reimar
Date: Sun Aug 12 19:57:35 2012
New Revision: 35081
Log:
Change "run" command to expand properties.
Patch by Jan Christoph Uhde [Jan UhdeJc com], documentation
part changed by me.
Modified:
trunk/DOCS/tech/slave.txt
trunk/command.c
Modified: trunk/DOCS/tech/slave.txt
==============================================================================
--- trunk/DOCS/tech/slave.txt Sun Aug 12 19:31:47 2012 (r35080)
+++ trunk/DOCS/tech/slave.txt Sun Aug 12 19:57:35 2012 (r35081)
@@ -508,9 +508,18 @@ hide
Hides the OSD menu console. Clicking a menu command unhides it. Other
keybindings act as usual.
-run <value>
- Run <value> as shell command. In OSD menu console mode stdout and stdin
- are through the video output driver.
+run <string>
+ Run <string> with properties expanded as shell command. In OSD menu
+ console mode stdout and stdin are through the video output driver.
+ Property expansion happens in the same way as for osd_show_property_text.
+ Note: MPlayer will do property expansion on anything of the form
+ ${somevar} before it is passed to the shell.
+ This means that you cannot use this syntax for anything you actually
+ want the shell to handle, though any other form like $somevar will
+ be passed on to and processed by the shell.
+
+ Example:
+ run "echo ${filename} ${stream_pos} >> <path_to_file>"
Available properties:
Modified: trunk/command.c
==============================================================================
--- trunk/command.c Sun Aug 12 19:31:47 2012 (r35080)
+++ trunk/command.c Sun Aug 12 19:57:35 2012 (r35081)
@@ -3346,7 +3346,11 @@ int run_command(MPContext *mpctx, mp_cmd
case MP_CMD_RUN:
#ifndef __MINGW32__
if (!fork()) {
- execl("/bin/sh", "sh", "-c", cmd->args[0].v.s, NULL);
+ char *exp_cmd = property_expand_string(mpctx, cmd->args[0].v.s);
+ if (exp_cmd) {
+ execl("/bin/sh", "sh", "-c", exp_cmd, NULL);
+ free(exp_cmd);
+ }
exit(0);
}
#endif
More information about the MPlayer-cvslog
mailing list