/**
* Méthode d'execution
*/
public function run()
{
// Initialisation des loggers
$this->getConfiguration()->initLoggers();
// Initialisation du process
$this->createProcess();
try {
// Lancement du process
$this->process->run(function ($type, $buffer) {
// On affiche le debug à l'écran pour s'assurer qu'aucune erreur
// bloquante n'est présente et suivre l'exécution des longs process
if ('err' === $type) {
echo 'ERR > ' . $buffer;
} else {
echo 'OUT > ' . $buffer;
}
});
// On récupère la sortie standard en cas de succès (STDOUT)
if ($this->process->isSuccessful()) {
$this->message .= $this->process->getOutput();
} else {
// On récupère la sortie standard en cas d'erreur (STDERR)
$this->message .= $this->process->getErrorOutput();
}
} catch (\Exception $e) {
$this->message .= $e->getMessage();
}
// Log du process
$this->report();
// Envoi des notifications
$this->notify();
}