Inexplicable Terminal Weirdness!!!

This has been driving me crazy all day.
For  my testing environment, I have a load of batch scripts. One of them starts the Apache and mysql server, one of them starts a websocket daemon, one of them sets environment variables, etc.

When I boot up phpstorm, first thing I do is start my Gulp filewatcher and in the terminal I type 'start_server' which runs a batch called start_server.
So far so good.
The other day I added the websocket server call to the start_server batch script. They all run in the background and don't output directly to the terminal.
My start_server script now consists of the following:

call setenv
START "" /B CALL xampp\apache_start>NUL 2>&1
START "" /B CALL xampp\mysql_start>NUL 2>&1
START "" /B CALL php start_daemon.php>NUL 2>&1
echo Server started

When I simply open the script, running via CMD, it works just fine.
However, if I run it in my terminal something very strange happens. All 5 lines run, it even outputs Server started, however, I notice my websoscket server isn't running (start_daemon.php). Line #4 seemingly isn't called.
After lots of agonizing I realized if I hit return a second time, line 4 finally executed.
So it's as if the 4th line is typed in but never entered.

I'm running Windows 10 and PhpStorm 10. I've tried CMD legacy mode, I've tried every way of running a background process I've tried removing all the unnecessary code. I can't figure this out.
If I simply call php start_daemon.php it works, but then it freezes the terminal window and stops me from inputting anything else.

I've come to the conclusion PHP Storm just does things a little differently to the normal CMD shell.
Again, this all works just fine if I run it in a CMD window.

Any ideas on fixing this unusual behaviour, or am I doing something stupid in the batch file?


Reducing the problem to it's simplest, I found that entering this into the terminal does exactly the same as the above (test.php consist of '<?php echo "this is a test";'

> START "" /B php "test.php"
[hit enter]
[hit enter]
>this is a test

Please sign in to leave a comment.