sylikc / pyexiftool

PyExifTool (active PyPI project) - A Python library to communicate with an instance of Phil Harvey's ExifTool command-line application. Runs one process with special -stay_open flag, and pipes data to/from. Much more efficient than running a subprocess for each command!
Other
148 stars 19 forks source link

don't hang if exiftool unexpectedly exits #81

Open diekhans opened 10 months ago

diekhans commented 10 months ago

The select loop from exiftool does not check for EOF, causing some expect failure to cause pyexiftool to hang.

This PR doesn't address the Window case, as I can't test it. However, I think it is near identical.

sylikc commented 10 months ago

Thanks for the issue report and PR. I'm going to have to see if I can write a test case to test this on both windows and Linux.

Does this occur when running a (probably easier to test on a long process) and then killing exiftool process while results are coming back?

I'll see if I can run it through a few process dying tests.

diekhans commented 10 months ago

The hang happened when I sent something to exiftool that caused it throw an error. Unfortunately, I can't make that happen any more.

This seems like a very hard thing to write a test cases for. Timing based test cases are brittle. I just tried killing the exiftool process while it was waiting between request and didn't get it to hang.

Personally, I would make sure it doesn't break the non-error cases (it passed all the test) and then do a careful code review. Sometimes, it just isn't worth the time to write a hard test case for rare error.

Kevin M @.***> writes:

Thanks for the issue report and PR. I'm going to have to see if I can write a test case to test this on both windows and Linux.

Does this occur when running a (probably easier to test on a long process) and then killing exiftool process while results are coming back?

I'll see if I can run it through a few process dying tests.

-- Reply to this email directly or view it on GitHub: https://github.com/sylikc/pyexiftool/pull/81#issuecomment-1831114338 You are receiving this because you authored the thread.

Message ID: @.***>