How to wait for a shell process to finish on ctrl+c before exiting?
Steven Schveighoffer
schveiguy at gmail.com
Mon Nov 25 15:35:36 UTC 2019
On 11/25/19 3:55 AM, aliak wrote:
> On Sunday, 24 November 2019 at 17:04:49 UTC, Steven Schveighoffer wrote:
>> On 11/24/19 10:44 AM, aliak wrote:
>>> [...]
>>
>> Hm.. are you sure that ctrl-c isn't also sending the signal to your
>> child process? I thought it did.
>>
>
> Yesh, you're right. That extra kill is unnecessary and was actually
> causing problems. So thanks for that!
As a general rule though, I would say you should do as LITTLE as
possible inside your signal handler. Being inside a signal handler is
unlike any other function, because you can be called from anywhere.
Locks can be held that are not normally, etc.
Most of the time, I just set flags in signal handlers and handle them
asynchronously outside in my main loop.
-Steve
More information about the Digitalmars-d-learn
mailing list