Running a php server in Phing -


i want run task in phing first run php server , run php unit test.

this have far:

<target name="test">     <!-- run php server -->     <exec executable="php">         <arg line="-s localhost:81 server.php"/>     </exec>      <!-- run tests -->     <exec executable="${phpunit.bin}" dir="${test.dir}" passthru="true" returnproperty="test.result">         <arg line="integrationtests"/>     </exec>      <!-- check if succeeded -->     <condition property="test.succeeded">         <equals arg1="${test.result}" arg2="0"/>     </condition>      <fail unless="test.succeeded" message="unit tests failed"/> </target> 

the issue phing hangs after creating php server.

the issue solved adding spawn property so:

<exec executable="php" spawn="true">

this works expected, except process never exits after phing exits. in other words, php server still running long after phing has completed it's tasks.

therefore question how run php server in background in phing?

phing's exectask not tell process id, can't kill $pid.

doing killall php kill phing itself, :)

the best option (still hack) pgrep php -s localhost , kill process:

<exec command="pkill -f 'php -s localhost:81'"/> 

but have in every case, if build fails - add line before checking succeeded property.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -