easy-deploy-bundle icon indicating copy to clipboard operation
easy-deploy-bundle copied to clipboard

OS determination in CommandExist is giving wrong result for remote servers.

Open waitxd opened this issue 8 years ago • 5 comments

For example if I'm trying to deploy from Windows-based machine to Unix-based one i'm receiving following error message: The command "ssh [email protected] "where /usr/local/bin/composer"" failed.

That's happening because of the check

   private function isWindows() : bool   
    {
        return '\\' === DIRECTORY_SEPARATOR;
    }

in CommandExists.php:40 which is only valid for local PHP instance and not for remote host.

waitxd avatar Jul 10 '17 17:07 waitxd

Which linux flavour are you deploying to?

This command also fails for me at the exact same point to a centos 7.3 vps, but on further investigation I realised the where command on centos is actually whereis

$shellCommand = sprintf('%s %s', $this->isWindows() ? 'where' : 'which', $this->commandName);

https://github.com/EasyCorp/easy-deploy-bundle/blob/master/src/Requirement/CommandExists.php#L33

Replace where by whereis and things proceed as expected.

The-Don-Himself avatar Jul 15 '17 17:07 The-Don-Himself

I'm using Ubuntu Server, so which is enough for me. But we can also use command -v {$this->commandName} or type -p {$this->commandName} as well. Or use them as a fallback.

waitxd avatar Jul 15 '17 19:07 waitxd

i'm having the same problem... shouldn't the server type (ie : windows or linux) be configurable ?

nikophil avatar Aug 27 '18 12:08 nikophil

Same problem ! Local OS is Windows, remote OS is Linux, which results in command not found error :-(.

ffouillet avatar Oct 08 '19 12:10 ffouillet

Same problem, any updates ?

Adeptuce avatar Oct 17 '19 16:10 Adeptuce