From 7b157b045aa3f7b5ca61d94b25ed03479759325e Mon Sep 17 00:00:00 2001 From: TheNooB Date: Fri, 11 Aug 2023 21:14:34 +0800 Subject: [PATCH] Use os.getlogin() instead of whoami command for getting username --- src/PIL/ImageGrab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PIL/ImageGrab.py b/src/PIL/ImageGrab.py index c510c835f..07540a1db 100644 --- a/src/PIL/ImageGrab.py +++ b/src/PIL/ImageGrab.py @@ -149,7 +149,7 @@ def grabclipboard(): loginctl = None if loginctl is not None: - username = subprocess.check_output("whoami").decode().strip("\n") + username = os.getlogin() sessionid = [ line.split()[0] for line in loginctl if username in line.split() ][0]