security/acme-client: fix command failure with gcloud, refs #3745

This commit is contained in:
Frank Wall
2024-01-06 17:40:41 +01:00
parent f7837735ed
commit e6742e3169
2 changed files with 13 additions and 1 deletions
+3
View File
@@ -8,6 +8,9 @@ WWW: https://github.com/acmesh-official/acme.sh
Plugin Changelog
================
Fixed:
* fix sporadic command failure with gcloud DNS API (#3745)
3.20
Added:
@@ -194,10 +194,19 @@ class LeUtils
// Make sure the resource could be setup properly
if (is_resource($proc)) {
// Close all pipes
// This workaround ensures that the accurate return code
// is reliably returned.
fclose($proc_pipes[0]);
$output = array();
while (!feof($proc_pipes[1])) {
$output[] = rtrim(fgets($proc_pipes[1], 1024), "\n");
}
fclose($proc_pipes[1]);
while (!feof($proc_pipes[2])) {
$output[] = rtrim(fgets($proc_pipes[2], 1024), "\n");
}
fclose($proc_pipes[2]);
// Get exit code
$result = proc_close($proc);
log_error(sprintf("AcmeClient: The shell command returned exit code '%d': '%s'", $result, $proc_cmd));