react-native run configuration issue
I am trying to create a run configuration for a react-native app.
I created one based off of the react-native template and when I run the configuration it loads 2 tabs in the run panel:
react-native start and Android (the name of my configuration)
I want to add another step "Before Launch"
I have written a bash script to start a chosen emulator (`start-emulator.sh`):
#!/bin/bash
echo Run App On:
echo 1 Device
echo 2 Emulator
read -r run
if [ "$run" = 2 ]; then
echo Select Device
emulator -list-avds | nl
read -r emulator
emulator -list-avds | sed -n "${emulator}p" | xargs emulator -avd
fi
Now I get an additional tab when running.
If I select 1 Device the new tab closes and the Android tab appears.
However, if I select 2 Emulator the emulator starts, but the Android tab never appears / starts.
I believe this is because the start-emulator script has not finished.
How do I tell PHPStorm to move on and run the rest of the configuration?
Ideally it would wait until after the user has gone through the prompts of `start-emulator.sh`, but this is not required, as the building of the App takes some time.
Please sign in to leave a comment.
Might be worth mentioning, "Before Launch" I added a "Run npm script" which in turn runs the bash script:
>I believe this is because the start-emulator script has not finished.
Exactly; a process added to Before launch has to return an exit code, the main process is waiting for it to start and thus doesn't start until the first process terminates. This is the way Before launch is designed - it's supposed to be used to run some sort of pre-processing before running the main process
>How do I tell PHPStorm to move on and run the rest of the configuration?
No way to do this
If you need both processes to run in parallel, you can try the custom Multirun plugin (https://plugins.jetbrains.com/plugin/7248-multirun/)
Ok, thanks for confirming. In the react-native template It has "Start React Native Bundler" in the "Before launch" section. This opens a tab which runs the react-native bundler. The bundler does not exit and yet the run-configuration is able to move forward with the rest of the run steps.
This appears to be the same scenario I am describing / trying to achieve for my custom script. Am I mis-interpreting this or is this a special case?
This is a special case