Implement Scanner-View
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
# shellcheck disable=SC2002 # disable useless-cat warning
|
||||
|
||||
set -o nounset # disallow usage of unset vars ( set -u )
|
||||
set -o errexit # Exit immediately if a pipeline returns non-zero. ( set -e )
|
||||
set -o errtrace # Allow the above trap be inherited by all functions in the script. ( set -E )
|
||||
#set -o errexit # Exit immediately if a pipeline returns non-zero. ( set -e )
|
||||
#set -o errtrace # Allow the above trap be inherited by all functions in the script. ( set -E )
|
||||
set -o pipefail # Return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status
|
||||
IFS=$'\n\t' # Set $IFS to only newline and tab.
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
|
||||
|
||||
|
||||
pid="$( pgrep -f 'flutter_tools\.[s]napshot run' || echo '' | tail -n 1 )"
|
||||
pids="$( pgrep -f 'flutter_tools\.[s]napshot run' || echo '' )"
|
||||
|
||||
if [ -z "$pid" ]; then
|
||||
if [ -z "$pids" ]; then
|
||||
red "No [flutter run] process found - exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -37,10 +37,21 @@ trap 'echo "reseived SIGNAL<SIGTERM> - exiting"; exit 0' SIGTERM
|
||||
trap 'echo "reseived SIGNAL<SIGQUIT> - exiting"; exit 0' SIGQUIT
|
||||
|
||||
echo ""
|
||||
blue "Listening for changes in lib/ directory - sending signals to ${pid}..."
|
||||
while IFS= read -r pid; do
|
||||
blue "Listening for changes in lib/ directory - sending signals to ${pid}..."
|
||||
done <<< "$pids"
|
||||
|
||||
echo ""
|
||||
|
||||
while true; do
|
||||
find lib/ -name '*.dart' | entr -d -p sh -c "echo 'File(s) changed - Sending SIGUSR to $pid' ; kill -USR1 $pid";
|
||||
yellow 'File list changed - restart';
|
||||
done
|
||||
while IFS= read -r pid; do
|
||||
{
|
||||
while true; do
|
||||
find lib/ -name '*.dart' | entr -d -p sh -c "echo 'File(s) changed - Sending SIGUSR to $pid' ; kill -USR1 $pid";
|
||||
yellow 'File list changed - restart';
|
||||
done
|
||||
} &
|
||||
done <<< "$pids"
|
||||
|
||||
wait # wait for all background jobs to finish
|
||||
|
||||
echo "DONE."
|
Reference in New Issue
Block a user