I need to figure out this seemingly very simple issue on windows .bat file. I have been using Linux for past 10 years full-time, so I am in pretty unfamiliar territory when it comes to .bat scripts.
We have some units tests that need to run on from this .bat file, and a build needs to be generated after the tests have run.
The bat file itself is very simple, I was thinking of just chaining the commands:
cls
echo "Running test suite - CRMSync"
echo
echo
REM from command: --static-backup
phpunit --bootstrap test/bootstrap_test.php --verbose --log-junit
echo "Running phploc for CRMSync"
phploc --count-tests --verbose > C:\CRMsync\testResults\phploc\index.html
echo "Executing phing"
phing
Now, simple enough except nothing is executed past phpunit command. How do I deal with this? The unit tests run fine, but I am suspecting it could even be in the unit test lib that process is killed. Is there a way to fork the process somehow or get the other commands below to run?
Thanks SO'ers, as always, any help greatly appreciated.
I had the same problem for a development script that I made. And I tried all given solutions without being successful. At the end, I did it with cmd /C.
From the windows docs it will:
Run Command and then terminate
So for example, you can use it as follows:
cls
echo "Running test suite - CRMSync"
echo
echo
REM from command: --static-backup
cmd /C phpunit --bootstrap test/bootstrap_test.php --verbose --log-junit
echo "Running phploc for CRMSync"
cmd /C phploc --count-tests --verbose > C:\CRMsync\testResults\phploc\index.html
echo "Executing phing"
cmd /C phing
I hope you find this useful.
Similar to the post ujifgc, I use "start /b ..." in these situations. If you encapsulate the call to phpunit in another batch file, you can use "call".
Is phpunit itself a batch file (I don't do much PHP, so am not familiar with the tool)? If so, try using:
call phpunit --bootstrap test/bootstrap_test.php --verbose --log-junit
Try start /WAIT phpunit ...
to fork process and wait for it or just start phpunit ...
to fork and continue. Help is here: start /?
I used
start /b code .
cmd /k ng serve --build-optimizer --aot
to start Visual Studio Code and then a node js server.
But the Command line glitched with the % update text and more.
I then used
cmd /C code .
cmd /k ng serve --build-optimizer --aot
and the glitching stopped for the server progress update.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With