mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +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"
|
msg = "wl-paste or xclip is required for ImageGrab.grabclipboard() on Linux"
|
||||||
raise NotImplementedError(msg)
|
raise NotImplementedError(msg)
|
||||||
fh, filepath = tempfile.mkstemp()
|
fh, filepath = tempfile.mkstemp()
|
||||||
subprocess.call(args, stdout=fh)
|
err = subprocess.run(args, stdout=fh, stderr=subprocess.PIPE).stderr
|
||||||
os.close(fh)
|
os.close(fh)
|
||||||
|
if err:
|
||||||
|
msg = f"{args[0]} error: {err.strip().decode()}"
|
||||||
|
raise ChildProcessError(msg)
|
||||||
im = Image.open(filepath)
|
im = Image.open(filepath)
|
||||||
im.load()
|
im.load()
|
||||||
os.unlink(filepath)
|
os.unlink(filepath)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user