diff --git a/recipes/msys2/all/conanfile.py b/recipes/msys2/all/conanfile.py index 752c04acf11c3..7c023fcf2b203 100644 --- a/recipes/msys2/all/conanfile.py +++ b/recipes/msys2/all/conanfile.py @@ -142,7 +142,8 @@ def _do_build(self): for package in packages: self.run(f'bash -l -c "pacman -S {package} --noconfirm"') for package in ['pkgconf']: - self.run(f'bash -l -c "pacman -Rs -d -d $(pacman -Qsq {package}) --noconfirm"') + if self.run(f'bash -l -c "pacman -Qq {package}"', ignore_errors=True, quiet=True) == 0: + self.run(f'bash -l -c "pacman -Rs -d -d {package} --noconfirm"') self._kill_pacman()