From 9af32ec4859c74982f36510a381986ff4407dc6a Mon Sep 17 00:00:00 2001 From: Sebastian Goscik Date: Fri, 27 May 2016 16:26:30 +0100 Subject: [PATCH] AndroidDevice: kick-off no longer requires root kick off will now use root if the device is rooted or if manually specified otherwise its run without root. --- devlib/target.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/devlib/target.py b/devlib/target.py index 5952faf..982fdbd 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -743,19 +743,16 @@ class AndroidTarget(Target): super(AndroidTarget, self).setup(executables) 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 device (this is different from execute(background=True) which keeps adb connection open and returns a subprocess object). - - .. note:: This relies on busybox's nohup applet and so won't work on unrooted devices. - """ - if not self.is_rooted: - raise TargetError('kick_off uses busybox\'s nohup applet and so can only be run a rooted device.') + if as_root is None: + as_root = self.is_rooted 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) except TimeoutError: pass