fork/exec & close file descriptors
alister
alister.nospam.ware at ntlworld.com
Wed Jun 3 05:38:36 EDT 2015
On Wed, 03 Jun 2015 10:41:44 +0300, Marko Rauhamaa wrote:
> Alain Ketterlin <alain at universite-de-strasbourg.fr.invalid>:
>
>> Marko Rauhamaa <marko at pacujo.net> writes:
>>> Maybe close() will fail for ever.
>>
>> Your program has to deal with this, something is going wrong, it can't
>> just close and go on.
>
> Here's the deal: the child process is saddled with file descriptors it
> never wanted in the first place. It can't decline them. Now you're
> saying it can't even dispose of them.
>
No You cab dispose of them you just need to warn the user that the action
did not complete correctly & there may be errors with the data.
Example What does your test editor do if you try to save a file back to a
USB stick that has been removed? does it simply let you think the file
has been successfully saved? i hope not.
> The reason this has been allowed to go on is that everybody just closes
> the file descriptors and ignores the possibility or repercussions of a
> failure. I haven't read about horror stories of this failing.
>
> I readily admit this is very dirty, but since the API doesn't offer a
> clean alternative, there's nothing you can/should do about it.
>
>
> Marko
--
Never be afraid to tell the world who you are.
-- Anonymous
More information about the Python-list
mailing list