diff --git a/security/acme-client/pkg-descr b/security/acme-client/pkg-descr index 41b68f69d..bfec3433c 100644 --- a/security/acme-client/pkg-descr +++ b/security/acme-client/pkg-descr @@ -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: diff --git a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeUtils.php b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeUtils.php index f7c497c78..cca7ce55e 100644 --- a/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeUtils.php +++ b/security/acme-client/src/opnsense/mvc/app/library/OPNsense/AcmeClient/LeUtils.php @@ -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));