Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
waitxd opened this issue Jul 10, 2017 · 5 comments

Comments

@waitxd
Copy link

waitxd commented Jul 10, 2017

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 test@example.com "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.

@The-Don-Himself
Copy link

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.

@waitxd
Copy link
Author

waitxd commented Jul 15, 2017

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.

@nikophil
Copy link

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

@ffouillet
Copy link

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

@Adeptuce
Copy link

Same problem, any updates ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants