[Freeipa-devel] [PATCH] 71 Propagate SIGINT to child process in ipautil.run

Jan Cholasta jcholast at redhat.com
Fri Mar 23 09:43:06 UTC 2012


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.

Updated patch attached.

Honza

-- 
Jan Cholasta
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-jcholast-71.1-propagate-sigint.patch
Type: text/x-patch
Size: 3435 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20120323/4f530fff/attachment.bin>


More information about the Freeipa-devel mailing list