On 2022-05-09 Mo 01:28, Michael Paquier wrote:
> Hi Andrew,
>
> On Sat, May 07, 2022 at 09:13:48AM +0900, Michael Paquier wrote:
>> Let's do that for now then as we need a middle ground for HEAD. I'll
>> come up with something at the beginning of next week.
> And here you go as of the attached to show the idea. The CI is able
> to execute and detect the default commands for lz4, gzip and zstd,
> while one of my boxes without any of those commands would ignore them.
> What do you think?
The system() call should include redirection, since we only case about
the return code.
I would just write this
+ if ($rc != 0)
+ {
+ # Execution of the default command failed, so reset its
+ # environment value.
+ $ENV{$envname} = '';
+ return;
+ }
+
+ # Set the environment to the default as it exists.
+ $ENV{$envname} = $envdefault;
+ return;
as
$ENV{$envname} = $envdefault if $rc == 0;
There should be no need to set it to the empty string in case if
failure, we already know it's undefined.
Otherwise looks good.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com