On Windows, I use PHP to execute a gulp
command.
Like this :
<?php
set_time_limit(0);
exec("cd /projectpath");
$results = exec("gulp");
?>
This works, but I can only get the results of the command after it has finished, which takes about 30 seconds.
I would like to write the results to a file, while it is running, so I can poll the progress in an interval using Ajax.
In a normal command prompt I can do
gulp > results.txt 2>&1
and the text file is being filled while the command is running.
I already tried shell_exec
(), system
() and passthru
() too, but I can't get this to work from within PHP.
Any idea's ?