pysystemmgr: Handling SIGCHLD signal

SystemManager starts multiple child processes when system state changes.
Set parent process to ignore the SIGCHLD signal, to prevent child
processes transforming into zombies when they terminate.

Resolves openbmc/openbmc#206

Change-Id: Ic8baa0cbb97f2df8fcc462a732a4194e4a6d3f8c
Signed-off-by: Yi Li <adamliyi@msn.com>
diff --git a/pysystemmgr/system_manager.py b/pysystemmgr/system_manager.py
index 819b4c0..b02be02 100644
--- a/pysystemmgr/system_manager.py
+++ b/pysystemmgr/system_manager.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python -u
 
 import sys
+import signal
 import subprocess
 import gobject
 import dbus
@@ -194,6 +195,8 @@
 
 
 if __name__ == '__main__':
+    # Ignore SIGCHLD signal, to prevent child process becoming zombie
+    signal.signal(signal.SIGCHLD, signal.SIG_IGN)
     dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
     bus = get_dbus()
     obj = SystemManager(bus, OBJ_NAME)