You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 15, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 15, 2026. It is now read-only.
Thekick_off method is broken for AndroidTarget #623
The kick_off method with Android Target is currently broken, it either exhibits blocking behaviour on the command to be ran or fails to run the command correctly.
Example blocking behaviour reproducer:
from devlib import AndroidTarget
target = AndroidTarget()
target.kick_off('sleep 10; echo "Completed" > /sdcard/sleep.log') # This command blocks until the command completes.
Example failure to execute reproducers:
target.kick_off('echo "Testing" > /sdcard/testing')
target.execute('cat /sdcard/testing')
"nohup: can't execute 'echo': No such file or directory\n"
target.kick_off('ls')
TargetTransientError: adb has returned early; did not get an exit code. Was kill-server invoked?
OUTPUT:
-----
0
nohup: appending output to nohup.out
-----
STDERR:
-----
-----
(export PATH=/root/devlib-target/bin:$PATH && export LC_ALL=C && cd /root/devlib-target && /root/devlib-target/bin/busybox nohup sh -c 'sleep 10; echo "Completed"' &) 2>&1
This error is not so surprising as echo is a shell builtin. Often there is also a binary but I guess not always on android.
"nohup: can't execute 'echo': No such file or directory\n"
I could not reproduce this one but it's easily explained:
target.kick_off('ls')
TargetTransientError: adb has returned early; did not get an exit code. Was kill-server invoked?
nohup wrote this line to stdout:
nohup: appending output to nohup.out
after the exit code. Unfortunately, adb_shell() parses the last line as the exit code 💥 . Should be easily fixable by redirecting nohup output to /dev/null
So overall I'd suggest:
Getting rid of the per-target implementation. That is a generic feature that can be implemented on top of other generic features.
The generic implementation should use nohup, but 1) redirect all output to /dev/null and 2) use quote(command) and interpolate that in sh -c {}.
will fix both the blocking issue and the shell builtin issue.
Activity
douglas-raillard-arm commentedon Apr 4, 2023
So I had a go at it, here are my observations:
sh -c:and it should be:
echois a shell builtin. Often there is also a binary but I guess not always on android.nohup wrote this line to stdout:
after the exit code. Unfortunately,
adb_shell()parses the last line as the exit code 💥 . Should be easily fixable by redirecting nohup output to /dev/nullSo overall I'd suggest:
nohup, but 1) redirect all output to /dev/null and 2) usequote(command)and interpolate that insh -c {}.target: Fix and generalize Target.kick_off()
target: Fix and generalize Target.kick_off()
target: Fix and generalize Target.kick_off()
target: Fix and generalize Target.kick_off()
target: Fix and generalize Target.kick_off()
target: Fix and generalize Target.kick_off()
target: Fix and generalize Target.kick_off()
target: Fix and generalize Target.kick_off()
target: Fix and generalize Target.kick_off()