From f4cecd0ba8ac346026828bd61a3dbb80c6d98db3 Mon Sep 17 00:00:00 2001 From: Jani Uusitalo Date: Mon, 16 Jul 2018 19:20:45 +0300 Subject: [PATCH] Add -f to all ps calls in Makefile (#1919) Output from procps' ps with -e only produces the process name, so grepping for "cli.js start" fails every time. This change adds (POSIX-compliant) -f to all ps calls to get the full command. AWK print parameter is adjusted accordingly where needed. --- Makefile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 7c66fafe5..e66a411ae 100644 --- a/Makefile +++ b/Makefile @@ -87,7 +87,7 @@ post-install: @cd ./node_modules/mattermost-redux && npm run build start: | pre-run ## Starts the React Native packager server - @if [ $(shell ps -e | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ + @if [ $(shell ps -ef | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ echo Starting React Native packager server; \ npm start; \ else \ @@ -139,7 +139,7 @@ prepare-android-build: run: run-ios ## alias for run-ios run-ios: | check-device-ios pre-run ## Runs the app on an iOS simulator - @if [ $(shell ps -e | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ + @if [ $(shell ps -ef | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ echo Starting React Native packager server; \ npm start & echo Running iOS app in development; \ if [ ! -z "${SIMULATOR}" ]; then \ @@ -158,7 +158,7 @@ run-ios: | check-device-ios pre-run ## Runs the app on an iOS simulator fi run-android: | check-device-android pre-run prepare-android-build ## Runs the app on an Android emulator or dev device - @if [ $(shell ps -e | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ + @if [ $(shell ps -ef | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ echo Starting React Native packager server; \ npm start & echo Running Android app in development; \ if [ ! -z ${VARIANT} ]; then \ @@ -177,25 +177,25 @@ run-android: | check-device-android pre-run prepare-android-build ## Runs the ap fi build-ios: | pre-run check-style ## Creates an iOS build - @if [ $(shell ps -e | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ + @if [ $(shell ps -ef | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ echo Starting React Native packager server; \ npm start & echo; \ fi @echo "Building iOS app" @cd fastlane && BABEL_ENV=production NODE_ENV=production bundle exec fastlane ios build - @ps -e | grep -i "cli.js start" | grep -iv grep | awk '{print $$1}' | xargs kill -9 + @ps -ef | grep -i "cli.js start" | grep -iv grep | awk '{print $$2}' | xargs kill -9 build-android: | pre-run check-style prepare-android-build ## Creates an Android build - @if [ $(shell ps -e | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ + @if [ $(shell ps -ef | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ echo Starting React Native packager server; \ npm start & echo; \ fi @echo "Building Android app" @cd fastlane && BABEL_ENV=production NODE_ENV=production bundle exec fastlane android build - @ps -e | grep -i "cli.js start" | grep -iv grep | awk '{print $$1}' | xargs kill -9 + @ps -ef | grep -i "cli.js start" | grep -iv grep | awk '{print $$2}' | xargs kill -9 unsigned-ios: pre-run check-style - @if [ $(shell ps -e | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ + @if [ $(shell ps -ef | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ echo Starting React Native packager server; \ npm start & echo; \ fi @@ -206,17 +206,17 @@ unsigned-ios: pre-run check-style @cd build-ios/ && mkdir -p Payload && cp -R Build/Products/Release-iphoneos/Mattermost.app Payload/ && zip -r Mattermost-unsigned.ipa Payload/ @mv build-ios/Mattermost-unsigned.ipa . @rm -rf build-ios/ - @ps -e | grep -i "cli.js start" | grep -iv grep | awk '{print $$1}' | xargs kill -9 + @ps -ef | grep -i "cli.js start" | grep -iv grep | awk '{print $$2}' | xargs kill -9 unsigned-android: pre-run check-style prepare-android-build - @if [ $(shell ps -e | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ + @if [ $(shell ps -ef | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \ echo Starting React Native packager server; \ npm start & echo; \ fi @echo "Building unsigned Android app" @cd fastlane && NODE_ENV=production bundle exec fastlane android unsigned @mv android/app/build/outputs/apk/app-unsigned-unsigned.apk ./Mattermost-unsigned.apk - @ps -e | grep -i "cli.js start" | grep -iv grep | awk '{print $$1}' | xargs kill -9 + @ps -ef | grep -i "cli.js start" | grep -iv grep | awk '{print $$2}' | xargs kill -9 test: | pre-run check-style ## Runs tests @npm test