From 99ee3ccbfdb2214359ce4cb44b971afcb0f59d38 Mon Sep 17 00:00:00 2001 From: Teoh Han Hui Date: Mon, 17 Jul 2017 19:10:36 +0800 Subject: [PATCH] [framework-bundle] Fix bin/console exit code on error in Makefile --- symfony/framework-bundle/3.3/Makefile | 30 +++++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/symfony/framework-bundle/3.3/Makefile b/symfony/framework-bundle/3.3/Makefile index 47f2341d..c11f5a20 100644 --- a/symfony/framework-bundle/3.3/Makefile +++ b/symfony/framework-bundle/3.3/Makefile @@ -1,19 +1,31 @@ +CONSOLE := $(shell which bin/console) +sf_console: +ifndef CONSOLE + @printf "Run \033[32mcomposer require cli\033[39m to install the Symfony console.\n" +endif + cache-clear: - @test -f bin/console && bin/console cache:clear --no-warmup || rm -rf var/cache/* +ifdef CONSOLE + @$(CONSOLE) cache:clear --no-warmup +else + @rm -rf var/cache/* +endif .PHONY: cache-clear cache-warmup: cache-clear - @test -f bin/console && bin/console cache:warmup || echo "cannot warmup the cache (needs symfony/console)" +ifndef CONSOLE + @printf "cannot warmup the cache (needs symfony/console)\n" + @exit 1 +endif + @$(CONSOLE) cache:warmup .PHONY: cache-warmup -CONSOLE=bin/console -sf_console: - @test -f $(CONSOLE) || printf "Run \033[32mcomposer require cli\033[39m to install the Symfony console.\n" - @exit - serve_as_sf: sf_console - @test -f $(CONSOLE) && $(CONSOLE)|grep server:start > /dev/null || ${MAKE} serve_as_php - @$(CONSOLE) server:start --docroot=public/ || exit 1 +ifndef CONSOLE + @${MAKE} serve_as_php +endif + @$(CONSOLE) | grep server:start > /dev/null || ${MAKE} serve_as_php + @$(CONSOLE) server:start --docroot=public/ @printf "Quit the server with \033[32;49mbin/console server:stop.\033[39m\n"