1
0
mirror of https://github.com/google/adb-sync.git synced 2026-01-03 09:58:01 +00:00
Files
adb-sync/adb-channel
Charlie Gorichanaz 491158ff46 Issue #11: adb-channel fix (#13)
* Consistent names, typo

* adb shell -n: don't read from stdin
2018-11-27 07:59:35 -08:00

23 lines
470 B
Bash
Executable File

#!/bin/sh
set -e
t=`mktemp -d -t adb-channel.XXXXXX`
remote=${1}
activity=${2}
delay=${3}
atexit() {
[ -z "${activity}" ] || adb shell am force-stop ${activity%%/*}
adb forward --remove localfilesystem:"${t}/sock"
rm -rf "${t}"
}
trap atexit EXIT
trap 'exit 0' HUP INT ALRM TERM
[ -z "${activity}" ] || adb shell -n am start -W ${activity}
[ -z "${delay}" ] || sleep "${delay}"
adb forward localfilesystem:"${t}/sock" "${remote}"
socat stdio unix:"${t}/sock"