Fix logging in run_external_command()

This commit is contained in:
Benjamin Renard 2021-10-07 20:47:26 +02:00
parent 5dd35cabb2
commit 4bb16803bf

View file

@ -337,10 +337,16 @@ function delete_directory($dir, $recursive=true) {
$return_value = proc_close($process);
if (!empty($stderr) || $return_value != 0)
logging('ERROR', "Externan command error:\nCommand : $command\nStdout :\n$stdout\n\n - Stderr :\n$stderr");
else
logging('DEBUG', "Externan command result:\n\tCommand : $command\n\tReturn code: $return_value\n\tOutput:\n\t\t- Stdout :\n$stdout\n\n\t\t- Stderr :\n$stderr");
$error = (!empty($stderr) || $return_value != 0);
logging(
($error?'ERROR':'DEBUG'),
"External command ".($error?"error":"result").":\n".
"\tCommand : $command\n".
"\tReturn code: $return_value\n".
"\tOutput:\n".
"\t\t- Stdout :\n$stdout\n\n".
"\t\t- Stderr :\n$stderr"
);
return array($return_value, $stdout, $stderr);
}