Closed marcbonnici closed 1 year ago
So I had a go at it, here are my observations:
SSH and Android have different kick_off() implementation
The SSH version properly does not block in the first case
The android version does block, because we lack a level of sh -c
:
(export PATH=/root/devlib-target/bin:$PATH && export LC_ALL=C && cd /root/devlib-target && /root/devlib-target/bin/busybox nohup sleep 10; echo "Completed" &) 2>&1
and it should be:
(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 :boom: . Should be easily fixable by redirecting nohup output to /dev/null
So overall I'd suggest:
nohup
, but 1) redirect all output to /dev/null and 2) use quote(command)
and interpolate that in sh -c {}
. 2) will fix both the blocking issue and the shell builtin issue.
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:
Example failure to execute reproducers: