mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-01 22:52:20 +08:00

* Display a longer message when reloading - It's easier to see * Make flutter_run start the reload script and kill it automatically. This is always the behaviour I want when running an app via flutter run.
25 lines
488 B
Bash
Executable File
25 lines
488 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
cd "$(dirname "$0")"
|
|
touch /tmp/flutter.pid
|
|
./reload.sh &
|
|
BGPID=$!
|
|
trap 'kill $BGPID; exit' SIGINT
|
|
cd ../
|
|
|
|
DEVICES=$(adb devices -l | tail -n +2)
|
|
NUM_DEVICES=$(echo "$DEVICES" | wc -l)
|
|
|
|
if [ "$NUM_DEVICES" = 1 ]; then
|
|
DEVICE_ID="$DEVICES"
|
|
else
|
|
DEVICE_ID=$(echo "$DEVICES" | fzf)
|
|
fi
|
|
|
|
DEVICE_ID=$(echo "$DEVICE_ID" | awk '{ print $1 }')
|
|
|
|
echo "Running on $DEVICE_ID"
|
|
flutter run -d "$DEVICE_ID" --pid-file /tmp/flutter.pid --observatory-port 8888 "$@"
|