Hi,
I've a wired issue executing exiftool from within my golang program code on windows (only).
I set `syscall.CREATE_NEW_PROCESS_GROUP` when I execute external programs, so that they don't immediately die when somebody presses CTRL+C. My program catches that and waits for external running programs to finish.
This seems to work fine for any external program I run, but exiftool immediately dies with error 2 or error 255 if SIGTERM is send to my program.
Any clue why, and what I can do to prevent that? Any cmdline option? In theory the exiftool process shouldn't see the SIGTERM/CTRL+C signal at all by being in its own process group.
That only happens on Windows, on MacOs and Linux it works fine - using `Setpgid: true` (supposed to be identical to CREATE_NEW_PROCESS_GROUP on windows)
Thanks,
Michael
Hi Michael,
I don't understand Windows signal handling. Internally, ExifTool handles SIGINT and SIGCONT signals, but other signals aren't treated specially. But the PAR packer may be doing something with the signals in the Windows version -- I haven't looked into this code. It would be interesting to know if you have the same problem with the alternate version of ExifTool for Windows (https://oliverbetz.de/pages/Artikel/ExifTool-for-Windows) (which doesn't use PAR).
- Phil
just tested with the alternate version - same problem.
it's probably a behavior of the perl interpreter itself on windows, that catches signals even they're not ment for the perl process.
Yes, that could be the problem. You might be able to bypass this problem by patching exiftool to watch for SIGTERM and ignore it, or something like that. Patching Oliver's version of ExifTool should be relatively easy. Try adding this line to the "exiftool" script to see if it helps:
$SIG{TERM} = 'SigCont';
- Phil
Quote from: Phil Harvey on February 18, 2020, 08:41:23 AM
Patching Oliver's version of ExifTool should be relatively easy. Try adding this line to the "exiftool" script to see if it helps:
patch the file "exiftool.pl", this is the one called by my launcher.
The original "exiftool" file is also in the archive but not called.
Probably I should add some note to a readme file about this...
Oliver
already tried, but didn't help. looks like the perl process gets killed.
Sorry. I don't have any other ideas. :(
no worries. thanks for trying..
golang shouldn't forward the SIGTERM in first place.. seems to be some windows related issue, since regarding a lot of googling there is no posix signaling in windows in general
but no clue why it works with non-perl programs.. it's just strange behavior I couldn't figure out...