# HG changeset patch
# User jfp <jf.pieronne@laposte.net>
# Date 1701697309 -3600
#      Mon Dec 04 14:41:49 2023 +0100
# Node ID 4479c7dd2219373173beba41733c02c96b848af2
# Parent  ead57151cf2f96bb35732841178a2908ecefbabe
Update template, create logical name table before deamonize supervisord

diff --git a/supervisord.com_template b/supervisord.com_template
--- a/supervisord.com_template
+++ b/supervisord.com_template
@@ -1,4 +1,4 @@
 $! @sys$startup:PYTHON310_SETUP.COM
 $! set default dev:[dir]
-$ python supervisord.py -c /dev/dir/supervisord.conf
+$ python -m supervisorvms.supervisord -c /dev/dir/supervisord.conf
 $ exit
\ No newline at end of file
diff --git a/supervisorvms/supervisord.py b/supervisorvms/supervisord.py
--- a/supervisorvms/supervisord.py
+++ b/supervisorvms/supervisord.py
@@ -532,7 +532,14 @@
         global supervisord_table_name
         assert self.process is not None
         pid = self.process.pid
-        finalsts = finalsts & 0xEFFFFFFF
+
+        # Bits 0--2 contain the severity level of the message.
+        # Bits 3--15 contain the number of the corresponding message.
+        # Bits 16--27 contain a number for the software component, or facility, that generated the message.
+        # Bits 28--31 contain internal control flags. 
+
+
+        finalsts = finalsts & 0xFFFF
         self.process.finalsts = finalsts
         self.process.end_time = end_time
         del Program.running_processes[pid]
@@ -942,6 +949,7 @@
     nodaemon = (
         config['supervisord'].getboolean('nodaemon', False) or args.nodaemon
     )
+    logicals_init()
     if not nodaemon and not is_deamon():
         usrdaemon = config['supervisord'].get('user', 'system')
         stdout_file = config['supervisord'].get('stdout_file', 'NLA0:')
@@ -1053,7 +1061,6 @@
             )
             Program.programs[name] = p
 
-    logicals_init()
     chan, Program.mbxunt, chancmd = mbx_init()
     run(chan, chancmd)