Przeglądaj źródła

Fix os.getpid() - use shell instead

Luis Rosales 2 miesięcy temu
rodzic
commit
6166de17bb
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5 1
      package/src/client2server-unified.lua

+ 5 - 1
package/src/client2server-unified.lua

@@ -670,8 +670,12 @@ local function main()
     
     buffer.init()
     
+    -- Write PID file
+    local f = io.popen("echo $", "r")
+    local pid = f and (f:read("*a") or "") or "0"
+    if f then f:close() end
     local pf = io.open(cfg.pid_file, "w")
-    if pf then pf:write(tostring(os.getpid())); pf:close() end
+    if pf then pf:write(pid); pf:close() end
     
     -- Connect
     log_info("Initial connection...")