tests: fixup checkcmd PATH on non-unixy platforms
Do not add unixy system directories to `PATH` when looking up commands on Windows, MS-DOS or OS/2. Cherry-picked from #14949 Closes #15106
This commit is contained in:
parent
f88fb1c83e
commit
aa092012bd
@ -155,13 +155,15 @@ our $stunnel; # path to stunnel command
|
|||||||
#
|
#
|
||||||
sub checkcmd {
|
sub checkcmd {
|
||||||
my ($cmd, @extrapaths)=@_;
|
my ($cmd, @extrapaths)=@_;
|
||||||
my $sep = '[:]';
|
my @paths;
|
||||||
if ($^O eq 'MSWin32' || $^O eq 'dos' || $^O eq 'os2') {
|
if ($^O eq 'MSWin32' || $^O eq 'dos' || $^O eq 'os2') {
|
||||||
# PATH separator is different
|
# PATH separator is different
|
||||||
$sep = '[;]';
|
@paths=(split(';', $ENV{'PATH'}), @extrapaths);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
@paths=(split(':', $ENV{'PATH'}), "/usr/sbin", "/usr/local/sbin",
|
||||||
|
"/sbin", "/usr/bin", "/usr/local/bin", @extrapaths);
|
||||||
}
|
}
|
||||||
my @paths=(split(m/$sep/, $ENV{'PATH'}), "/usr/sbin", "/usr/local/sbin",
|
|
||||||
"/sbin", "/usr/bin", "/usr/local/bin", @extrapaths);
|
|
||||||
for(@paths) {
|
for(@paths) {
|
||||||
if( -x "$_/$cmd" . exe_ext('SYS') && ! -d "$_/$cmd" . exe_ext('SYS')) {
|
if( -x "$_/$cmd" . exe_ext('SYS') && ! -d "$_/$cmd" . exe_ext('SYS')) {
|
||||||
# executable bit but not a directory!
|
# executable bit but not a directory!
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user