Description
When an Android device is connected via Wi-Fi/mDNS, the ADB device serial can contain parentheses, e.g.:
adb-5721009297-Rq3U4s (2)._adb-tls-connect._tcp
This causes all Detox tests to fail with:
/bin/sh: -c: line 0: syntax error near unexpected token `('
Root Cause
In src/devices/common/drivers/android/exec/ADB.js line 391, the device serial is interpolated without quoting:
const serial = `${deviceId ? `-s ${deviceId}` : ''}`;
const cmd = `"${this.adbBin}" ${serial} ${params}`;
The shell interprets ( as a subshell start, causing a parse error.
Note: adbCmdSpawned (line 400) is not affected because it passes arguments as an array to spawn, bypassing shell interpretation.
Fix
Quote the device serial:
const serial = `${deviceId ? `-s "${deviceId}"` : ''}`;
Environment
- Detox: 20.47.0
- Device: Physical Android connected via Wi-Fi (mDNS)
- ADB serial:
adb-5721009297-Rq3U4s (2)._adb-tls-connect._tcp
- Host: macOS
Description
When an Android device is connected via Wi-Fi/mDNS, the ADB device serial can contain parentheses, e.g.:
This causes all Detox tests to fail with:
Root Cause
In
src/devices/common/drivers/android/exec/ADB.jsline 391, the device serial is interpolated without quoting:The shell interprets
(as a subshell start, causing a parse error.Note:
adbCmdSpawned(line 400) is not affected because it passes arguments as an array tospawn, bypassing shell interpretation.Fix
Quote the device serial:
Environment
adb-5721009297-Rq3U4s (2)._adb-tls-connect._tcp