Skip to content

Commit 3aee098

Browse files
committed
Check platform.system() to use different adb command for windows
1 parent bba02da commit 3aee098

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

screenshot.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import os
2+
import platform
23

34

45
def capture_screenshot(filename):
56
"""
67
Captures a screenshot of the Android screen using adb and saves it to a file.
78
Returns True if the adb command was successful, False otherwise.
89
"""
9-
adb_command = "adb exec-out screencap -p > {}".format(filename)
10+
if platform.system() == "Windows":
11+
adb_command = "adb exec-out screencap -p > {}".format(filename)
12+
else:
13+
adb_command = "adb exec-out screencap -p > {} 2> /dev/null".format(filename)
1014
error_code = os.system(adb_command)
1115
return error_code == 0

0 commit comments

Comments
 (0)