Browse Source

Changed the way webui calls uwsgi

Using execl instead of fork to preserv the pid
Yann Weber 7 years ago
parent
commit
7618a7bed7
2 changed files with 6 additions and 3 deletions
  1. 1
    1
      plugins/webui/confspec.py
  2. 5
    2
      plugins/webui/main.py

+ 1
- 1
plugins/webui/confspec.py View File

@@ -10,7 +10,7 @@ CONFSPEC = {
10 10
                             SettingValidator('int')),
11 11
         'virtualenv': (None,
12 12
                        SettingValidator('path', none_is_valid=True)),
13
-        'uwsgicmd': ('uwsgi_python3', SettingValidator('dummy')),
13
+        'uwsgicmd': ('/usr/bin/uwsgi_python3', SettingValidator('dummy')),
14 14
         'cookie_secret_key': ('ConfigureYourOwnCookieSecretKey', SettingValidator('dummy')),
15 15
         'cookie_session_id': ('lodel', SettingValidator('dummy'))
16 16
     },

+ 5
- 2
plugins/webui/main.py View File

@@ -2,6 +2,7 @@
2 2
 
3 3
 import os, os.path
4 4
 import sys
5
+import shlex
5 6
 from lodel.plugin import LodelHook
6 7
 from lodel.settings import Settings
7 8
 
@@ -35,7 +36,9 @@ def uwsgi_fork(hook_name, caller, payload):
35 36
             cmd = cmd.format(uwsgi = Settings.webui.uwsgicmd)
36 37
         
37 38
         try:
38
-            exit(os.system(cmd))
39
+            args = shlex.split(cmd)
40
+            exit(os.execl(args[0], *args))
39 41
         except Exception as e:
40
-            print("Webui plugin uwsgi fork fails : ", e, file=sys.stderr)
42
+            print("Webui plugin uwsgi execl fails cmd was '%s' error : " % cmd,
43
+                e, file=sys.stderr)
41 44
             exit(1)

Loading…
Cancel
Save