tags:

views:

49

answers:

2
+1  A: 

exec() will suspend your script while the exec'd program is running. Control will be returned only when the external program terminates. If you want to see if the program's hung up or waiting for input or somesuch, you use popen(), which returns a filehandle from which you can read the program's output. At that point you can do a polling loop to see if there's been any output:

$app = popen("your shell command here");

while($output = fgets($app)) {
   // handle output
   sleep(5); // sleep 5 seconds
}       

If you want to send something to the app as input, then you have to use proc_open(), which allows bi-directional communication between your script and the external program.

Marc B
A: 

accurately answered the question

tweakmy