From 267fafeaf0e0311952316ae0f3c765abc7516469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C4=83t=C4=83lin=20G?= Date: Mon, 23 Aug 2021 16:43:27 +0300 Subject: [PATCH] Allow skip of sail checks (#224) * When setting the SKIP_SAIL_CHECKS env variable the docker exec will speed up a bit * Update sail * Update sail Co-authored-by: Taylor Otwell --- bin/sail | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/bin/sail b/bin/sail index 17bf9250..3bd246b2 100755 --- a/bin/sail +++ b/bin/sail @@ -34,28 +34,6 @@ export SAIL_SHARE_DASHBOARD=${SAIL_SHARE_DASHBOARD:-4040} export SAIL_SHARE_SERVER_HOST=${SAIL_SHARE_SERVER_HOST:-"laravel-sail.site"} export SAIL_SHARE_SERVER_PORT=${SAIL_SHARE_SERVER_PORT:-8080} -# Ensure that Docker is running... -if ! docker info > /dev/null 2>&1; then - echo -e "${WHITE}Docker is not running.${NC}" >&2 - - exit 1 -fi - -# Determine if Sail is currently up... -PSRESULT="$(docker-compose ps -q)" - -if docker-compose ps | grep $APP_SERVICE | grep 'Exit'; then - echo -e "${WHITE}Shutting down old Sail processes...${NC}" >&2 - - docker-compose down > /dev/null 2>&1 - - EXEC="no" -elif [ -n "$PSRESULT" ]; then - EXEC="yes" -else - EXEC="no" -fi - # Function that outputs Sail is not running... function sail_is_not_running { echo -e "${WHITE}Sail is not running.${NC}" >&2 @@ -65,6 +43,31 @@ function sail_is_not_running { exit 1 } +if [ -z "$SAIL_SKIP_CHECKS" ]; then + # Ensure that Docker is running... + if ! docker info > /dev/null 2>&1; then + echo -e "${WHITE}Docker is not running.${NC}" >&2 + + exit 1 + fi + + # Determine if Sail is currently up... + PSRESULT="$(docker-compose ps -q)" + if docker-compose ps | grep $APP_SERVICE | grep 'Exit'; then + echo -e "${WHITE}Shutting down old Sail processes...${NC}" >&2 + + docker-compose down > /dev/null 2>&1 + + EXEC="no" + elif [ -n "$PSRESULT" ]; then + EXEC="yes" + else + EXEC="no" + fi +else + EXEC="yes" +fi + if [ $# -gt 0 ]; then # Proxy PHP commands to the "php" binary on the application container... if [ "$1" == "php" ]; then