[vlc-devel] [PATCH] lua: rc: prevent interface from terminating VLC immediately

Marvin Scholz epirat07 at gmail.com
Sat May 30 20:53:29 CEST 2020


When starting VLC without stdin attached (for example on Windows
from the explorer or on macOS from Finder by double clicking the app)
the lua interface if set up as extra interface would immediately
terminate it again.
For users that set the extra interface up using the GUI, they are no
longer able to revert that change as the main interface will immediately
terminate together with VLC, which is really bad user experience.

Prevent the immediate termination by refusing to load the lua rc
interface without valid input.
---
 share/lua/intf/cli.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua
index 02c6967abb..dc01286499 100644
--- a/share/lua/intf/cli.lua
+++ b/share/lua/intf/cli.lua
@@ -807,6 +807,7 @@ h:listen( config.hosts or config.host or "*console" )
 password = config.password or "admin"
 
 --[[ The main loop ]]
+local starting = 1
 while running do
     local write, read = h:accept_and_select()
 
@@ -818,7 +819,10 @@ while running do
 
     for _, client in pairs(read) do
         local input = client:recv(1000)
-
+        if input ==  nil and starting == 1 then
+            vlc.msg.err("Can't read from stdin, exiting cli interface")
+            return
+        end
         if input == nil -- the telnet client program has left
             or ((client.type == host.client_type.net
                  or client.type == host.client_type.telnet)
@@ -864,6 +868,7 @@ while running do
             client.buffer = saved_buffer .. client.buffer
         end
     end
+    starting = 0
 end
 
 --[[ Clean up ]]
-- 
2.24.1 (Apple Git-126)



More information about the vlc-devel mailing list