On Tue, 2012-03-20 at 17:48 +0100, Jan Cholasta wrote:
> Propagate SIGINT to child process in ipautil.run.
> 
> Wait for the child process to terminate before continuing.
> 
> Do cleanup on KeyboardInterrupt rather than in custom SIGINT handler in 
> ipa-replica-conncheck.
> 
> https://fedorahosted.org/freeipa/ticket/2127
> 
> Honza

This looks and works OK, I have just one minor issue. Isn't the extra
p.wait() you added to the standard run() path redundant? p.communicate()
should do the job of waiting until the child process terminates.

+    try:
+        p = subprocess.Popen(args, stdin=p_in, stdout=p_out,
stderr=p_err,
+                             close_fds=True, env=env)
+        stdout,stderr = p.communicate(stdin)
+        stdout,stderr = str(stdout), str(stderr)    # Make pylint happy
+        p.wait()
+    except KeyboardInterrupt:

Martin

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to