1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

Merge pull request #39 from ep1cman/fixes

AndroidDevice: kick-off no longer requires root
This commit is contained in:
setrofim 2016-05-27 16:37:55 +01:00
commit bbee251547

View File

@ -749,19 +749,16 @@ class AndroidTarget(Target):
super(AndroidTarget, self).setup(executables) super(AndroidTarget, self).setup(executables)
self.execute('mkdir -p {}'.format(self._file_transfer_cache)) self.execute('mkdir -p {}'.format(self._file_transfer_cache))
def kick_off(self, command, as_root=False): def kick_off(self, command, as_root=None):
""" """
Like execute but closes adb session and returns immediately, leaving the command running on the Like execute but closes adb session and returns immediately, leaving the command running on the
device (this is different from execute(background=True) which keeps adb connection open and returns device (this is different from execute(background=True) which keeps adb connection open and returns
a subprocess object). a subprocess object).
.. note:: This relies on busybox's nohup applet and so won't work on unrooted devices.
""" """
if not self.is_rooted: if as_root is None:
raise TargetError('kick_off uses busybox\'s nohup applet and so can only be run a rooted device.') as_root = self.is_rooted
try: try:
command = 'cd {} && {} nohup {}'.format(self.working_directory, self.bin('busybox'), command) command = 'cd {} && {} nohup {}'.format(self.working_directory, self.busybox, command)
output = self.execute(command, timeout=1, as_root=as_root) output = self.execute(command, timeout=1, as_root=as_root)
except TimeoutError: except TimeoutError:
pass pass