mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Raise error from stderr of Linux grabclipboard command
This commit is contained in:
parent
e3cb4bb8e0
commit
ab3d0c071e
|
@ -141,8 +141,11 @@ def grabclipboard():
|
|||
msg = "wl-paste or xclip is required for ImageGrab.grabclipboard() on Linux"
|
||||
raise NotImplementedError(msg)
|
||||
fh, filepath = tempfile.mkstemp()
|
||||
subprocess.call(args, stdout=fh)
|
||||
err = subprocess.run(args, stdout=fh, stderr=subprocess.PIPE).stderr
|
||||
os.close(fh)
|
||||
if err:
|
||||
msg = f"{args[0]} error: {err.strip().decode()}"
|
||||
raise ChildProcessError(msg)
|
||||
im = Image.open(filepath)
|
||||
im.load()
|
||||
os.unlink(filepath)
|
||||
|
|
Loading…
Reference in New Issue
Block a user