On Mac 10.13:
% /usr/sbin/screencapture ./.foo.png; echo $?
0
Mac 10.14:
% /usr/sbin/screencapture ./.foo.png; echo $?
screencapture: cannot write file to intended destination, ./.foo.png
0
Two issues on which I'm seeking clarification:
- It appears you can't screencapture to a file starting with a dot (".") prefix in Mojave. Is this intended behavior?
- Given the failure to write the file, I would expect the exit-status code to be non-zero. Return zero causes later issues in my software's logic when the file doesn't exist.