From a4f89ecc5f3eea5c240abce15a7116bb411b5572 Mon Sep 17 00:00:00 2001 From: Siddarth Kumar Date: Sat, 30 Mar 2024 19:53:42 +0530 Subject: [PATCH] keep existing metro session alive The killing of metro terminal upset a few people and this PR fixes that. ## Summary Modify build step to check if metro is running already. If so then we do not attempt to start metro again. If not then we start metro after building android / iOS. ## Review notes * case 1 - `make run-clojure` - `make run-metro` - `make run-android` or `make run-ios` should work the way it did before. * case 2 - `make run-clojure` - `make run-android` or `make run-ios` should also work. ## Platforms - Android - iOS --- scripts/run-metro.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/run-metro.sh b/scripts/run-metro.sh index 37741881c604..55c54c908242 100755 --- a/scripts/run-metro.sh +++ b/scripts/run-metro.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash -pkill -f 'react-native start' - -react-native start --reset-cache +if pgrep -f 'react-native start' > /dev/null; then + echo "Info: metro is already running in another terminal" +else + echo "Info: starting a new metro terminal" + react-native start --reset-cache +fi