Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
development
Commits
fb4dd3e6
Commit
fb4dd3e6
authored
9 years ago
by
Josh Gao
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Download
Plain Diff
Merge "gdbrunner: avoid using `[` on older devices."
parents
a8afb139
095a4a27
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
python-packages/gdbrunner/__init__.py
python-packages/gdbrunner/__init__.py
+11
-4
No files found.
python-packages/gdbrunner/__init__.py
View file @
fb4dd3e6
...
...
@@ -100,20 +100,27 @@ def get_processes(device):
# Perform the check for this on the device to avoid an adb roundtrip
# Some devices might not have readlink or which, so we need to handle
# this as well.
#
# Gracefully handle [ or readlink being missing by always using `ps` if
# readlink is missing. (API 18 has [, but not readlink).
ps_script
=
"""
if [ ! -x /system/bin/readlink -o ! -x /system/bin/which ]; then
ps;
elif [ $(readlink $(which ps)) == "toolbox" ]; then
if $(ls /system/bin/readlink >/dev/null 2>&1); then
if [ $(readlink /system/bin/ps) == "toolbox" ]; then
ps;
else
else
ps -w;
fi
else
ps;
fi
"""
ps_script
=
" "
.
join
([
line
.
strip
()
for
line
in
ps_script
.
splitlines
()])
output
,
_
=
device
.
shell
([
ps_script
])
return
parse_ps_output
(
output
)
def
parse_ps_output
(
output
):
processes
=
dict
()
output
=
adb
.
split_lines
(
output
.
replace
(
"
\r
"
,
""
))
columns
=
output
.
pop
(
0
).
split
()
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment