Skip to content

Commit 059fc4d

Browse files
authored
Merge pull request dtmilano#201 from theAddict/master
Fixing Dump on Windows 10 when adb is used to fetch the serial
2 parents 53ac76f + b6247e5 commit 059fc4d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/com/dtmilano/android/viewclient.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2604,7 +2604,13 @@ def __obtainDeviceSerialNumber(device):
26042604
# If there's only one device connected get its serialno
26052605
adb = ViewClient.__obtainAdbPath()
26062606
if DEBUG_DEVICE: print >>sys.stderr, " using adb=%s" % adb
2607-
s = subprocess.Popen([adb, 'get-serialno'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env={}).communicate()[0][:-1]
2607+
# Remove ANDROID_SERIAL from the environment when using adb to
2608+
# obtain the serial number of the device, because if the serial
2609+
# number was specified as an environment variable that contains a
2610+
# regular expression, adb will always return 'unknown'.
2611+
env = os.environ.copy()
2612+
env.pop("ANDROID_SERIAL", None)
2613+
s = subprocess.Popen([adb, 'get-serialno'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env).communicate()[0][:-1]
26082614
if s != 'unknown':
26092615
serialno = s
26102616
if DEBUG_DEVICE: print >>sys.stderr, " serialno=%s" % serialno

0 commit comments

Comments
 (0)