Commit 07052a25 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

nxdialog: allow to provide --parent 0 for testing

Agent PID 0 can be used for testing
parent acffe15b
...@@ -234,10 +234,12 @@ def handle_session_action(agentpid, action): ...@@ -234,10 +234,12 @@ def handle_session_action(agentpid, action):
if action == DISCONNECT: if action == DISCONNECT:
print("Disconnecting from session, sending SIGHUP to %s" % (agentpid)) print("Disconnecting from session, sending SIGHUP to %s" % (agentpid))
if agentpid != 0:
os.kill(agentpid, signal.SIGHUP) os.kill(agentpid, signal.SIGHUP)
elif action == TERMINATE: elif action == TERMINATE:
print("Terminating session, sending SIGTERM to process %s" % (agentpid)) print("Terminating session, sending SIGTERM to process %s" % (agentpid))
if agentpid != 0:
os.kill(agentpid, signal.SIGTERM) os.kill(agentpid, signal.SIGTERM)
elif action is None: elif action is None:
...@@ -339,7 +341,7 @@ class NxDialogProgram(object): ...@@ -339,7 +341,7 @@ class NxDialogProgram(object):
if dlgtype in (DLG_TYPE_PULLDOWN, if dlgtype in (DLG_TYPE_PULLDOWN,
DLG_TYPE_YESNOSUSPEND, DLG_TYPE_YESNOSUSPEND,
DLG_TYPE_YESNO) and not self.options.agentpid: DLG_TYPE_YESNO) and self.options.agentpid is None:
sys.stderr.write("Agent pid not supplied via --parent\n") sys.stderr.write("Agent pid not supplied via --parent\n")
sys.exit(EXIT_FAILURE) sys.exit(EXIT_FAILURE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment