[Freeipa-devel] [PATCH] 71 Propagate SIGINT to child process in ipautil.run
Martin Kosek
mkosek at redhat.com
Fri Mar 23 10:00:12 UTC 2012
On Fri, 2012-03-23 at 10:43 +0100, Jan Cholasta wrote:
> On 22.3.2012 16:35, Martin Kosek wrote:
> > 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:
> >
>
> You are of course right, I guess I should read documentation more carefully.
>
> > Martin
> >
>
> Also, SIGINT is already propagated to the child process, we just need to
> wait for it to terminate.
Yeah, with p.wait() there is also no left-over in a form of zombie
process.
>
> Updated patch attached.
>
> Honza
>
ACK. Pushed to master, ipa-2-2.
Martin
More information about the Freeipa-devel
mailing list