How will I know if CP executed sucessfully (commandline)?

I am calling CellProfiler from a php script like this:

			$command = '"'.$cpExePath.'" --jvm-heap-size=16g -c -r -o '.$outputFolder.' -p '.$outputProjFile.' --ij-plugins-directory="'.$cpPluginsPath.'"'.' -i "'.$curFolder.'"';
			exec($command, $cpOutput);

How should I do to know if CellProfiler finished successfully, or if there was some exception? The $cpOutput will in this case only contain something like below, regardless whether it was successful or not:

stopping worker thread 0
stopping worker thread 1
stopping worker thread 2
stopping worker thread 3
stopping worker thread 4
stopping worker thread 5
stopping worker thread 6
stopping worker thread 7
stopping worker thread 8

We have a command-line switch for headless batch mode which you can use for this:

-d

or

–done-file

CellProfiler will write the single line, “Complete”, to the file if the pipeline finished correctly and “Failure” if it did not. I suppose that returning an exec status might be better than this. I can file an issue if you’d like, but checking the done file will get you by in the meantime.

–Lee

OK, I will try that. Thanks for the reply.

Yes, that works fine. Thanks, Lee :smiley: