Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions devlib/bin/scripts/shutils.in
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ cgroups_run_into() {

# Check if the required CGroup exists
$FIND $CGMOUNT -type d -mindepth 1 | \
$GREP -E "^$CGMOUNT/devlib_cgh[0-9]{1,2}$CGP" &>/dev/null
$GREP -E "^$CGMOUNT/devlib_cgh[0-9]{1,2}$CGP" >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR: could not find any $CGP cgroup under $CGMOUNT"
exit 1
Expand Down Expand Up @@ -345,7 +345,7 @@ _command_not_found() {
exit 1
}
# Check the command exists
type "$CMD" 2>&1 >/dev/null || _command_not_found
type "$CMD" >/dev/null 2>&1 || _command_not_found

"$CMD" "$@"

Expand Down
35 changes: 13 additions & 22 deletions devlib/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,19 @@ def background_invoke(self, binary, args=None, in_directory=None,
command = 'cd {} && {}'.format(quote(in_directory), command)
return self.background(command, as_root=as_root)

def kick_off(self, command, as_root=False):
raise NotImplementedError()
@asyn.asyncf
async def kick_off(self, command, as_root=None):
"""
Like execute() but returns immediately. Unlike background(), it will
not return any handle to the command being run.
"""
cmd = 'cd {wd} && {busybox} sh -c {cmd} >/dev/null 2>&1'.format(
wd=quote(self.working_directory),
busybox=quote(self.busybox),
cmd=quote(command)
)
self.background(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, as_root=as_root)


# sysfs interaction

Expand Down Expand Up @@ -1581,11 +1592,6 @@ def __init__(self,
def wait_boot_complete(self, timeout=10):
pass

@call_conn
def kick_off(self, command, as_root=False):
command = 'sh -c {} 1>/dev/null 2>/dev/null &'.format(quote(command))
return self.conn.execute(command, as_root=as_root)

@asyn.asyncf
async def get_pids_of(self, process_name):
"""Returns a list of PIDs of all processes with the specified name."""
Expand Down Expand Up @@ -1833,21 +1839,6 @@ async def connect(self, timeout=30, check_boot_completed=True, max_async=None):
max_async=max_async,
)

@asyn.asyncf
async 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).
"""
if as_root is None:
as_root = self.needs_su
try:
command = 'cd {} && {} nohup {} &'.format(quote(self.working_directory), quote(self.busybox), command)
await self.execute.asyn(command, timeout=1, as_root=as_root)
except TimeoutError:
pass

@asyn.asyncf
async def __setup_list_directory(self):
# In at least Linaro Android 16.09 (which was their first Android 7 release) and maybe
Expand Down