Skip to content

Commit 89c40fb

Browse files
committed
utils.adb_shell: Move from 'echo CMD | su' to '-c'
Move from the current implementation (piping the command to su) which has unexpected behaviours to the '-c' su flag (which then becomes required).
1 parent aa5aa2f commit 89c40fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

devlib/utils/android.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def adb_shell(device, command, timeout=None, check_exit_code=False,
431431
if device is not None:
432432
parts += ['-s', device]
433433
parts += ['shell',
434-
command if not as_root else 'echo {} | su'.format(quote(command))]
434+
command if not as_root else 'su -c {}'.format(quote(command))]
435435

436436
logger.debug(' '.join(quote(part) for part in parts))
437437
# On older combinations of ADB/Android versions, the adb host command always

0 commit comments

Comments
 (0)