-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge stdout and stderr to see errors easier #8
Merge stdout and stderr to see errors easier #8
Conversation
Could you please provide me a picture that makes ExifTool (CLI) raise an error on stderr that is not a "file not found" ? I've edited a JPG file (altering random bytes):
Nothing is goes out on stderr, bu the following appears on stdout:
|
The only error that I've been able to pop on stderr is a non existing file:
This is checked in the go code (before invoking exiftool) |
Yes, the only one error I got from exiftool is "file not found" too. But when I got a stuck on Windows because of #7 for the first time, I couldn't understand the reason of it.
I'm newbie in exiftool, so I suggested that the reason of the stuck is the encoding problem in Windows and tried to tune the parameter Of course, after debugging go-exiftool line-to-line for few ... eternities, I found the reason in function splitReadyToken that couldn't find the token even if it was there. The ability to see the full output from exiftool could save a lot of time on debugging. I think it's a must have feature. |
I totally agree with #7 : I already merged your pull request and I thank you once more. Let's just discuss this pull request: the stdout and stderr merge.
To do it properly, I don't think that merging stdout and stderr is the right way to do it. |
I agree that we should analyze stderr and stdout separately (a perfect case). But It takes much more effort to change the code... go-exiftool runs exiftool in -stay_open mode with json-format. So warning is just a field of json:
It should be safe. If I still haven't been able to convince you this moment, I agree to close the PR :) |
You've convinced me that stderr should be taken care of. I unfortunately do not have time to do it right now the way I'd like it to be done: I'll make some tests with your implementation and if everything's fine, I'll merge it. I'll add an issue to adapt this later. So, do not close the PR. |
Problem
When exiftool reports about errors, it prints them to stderr. But go-exiftool pipes only stdout, so there's no way to find out what happened.
Solution
Let's merge stdout and stderr:
It allows us to see error output when unmarshalling json:
Warning
Closing and freeing resources statements should be reviewed after me...