Pillow
Pillow copied to clipboard
Raise error if ImageGrab subprocess gives non-zero returncode
https://github.com/python-pillow/Pillow/pull/9070#discussion_r2574705199 suggested checking the subprocess return code in ImageGrab. This PR adds it, following the example of https://github.com/python-pillow/Pillow/blob/b0a5bc2a6b9842648727f8db99ca5c9ee8126779/src/PIL/GifImagePlugin.py#L909-L910
I've also added additional testing, as per https://github.com/python-pillow/Pillow/pull/9070#discussion_r2574705182, including opening a new window on macOS to test capturing it. To avoid interfering too much with user machines though, this will only happen on CIs.