target_sh revision f637a050cc27b206824d7b1262d2aa9de0668bef
1#!/bin/bash
2set -e -o pipefail
3
4# Run a command on the target Android device.
5#
6# Usage: target_sh <cmd> <args>...
7
8target="$1"
9shift
10
11exitcode="$(target_tmpdir)/exitcode"
12adb_${target} shell "$*; echo -n \$? > ${exitcode}" | sed -e 's:\r$::' -u
13exit $(adb_${target} shell "cat ${exitcode}")
14