Closed Sectimus closed 4 months ago
I think the issue is surprisingly simple here. The error is that docker exec -t ...
ENOENT or does not exist. That's correct. docker exec -t ...
is indeed not a file that exists. docker
(or more accurately something like /usr/bin/docker
) is a file that exists.
So the short answer is: binCommand
is an array that should contain the individual parts of the command to be ran and its args, not the entire command as one arg (similar to how spawn
is called in node, unix, etc). So it should be: ["docker", "exec", "-t", "REDACTED_api_php-1", "/bin/sh", "-c", "/var/www/REDACTED/vendor/bin/phpstan"]
. Or maybe all after -t
should be a single arg that is passed to docker, you might have to try around with that.
I'll add an example to the README.md showing this too.
Let me know if this helps
This actually did do the trick! I did think to separate each flag of the command to it's own array element, but not each piece individually ["--someflag somevalue", "--otherflag othervalue"]
vs your suggestion of ["--someflag", "somevalue", "--otherflag", "othervalue"]
Good to hear! I'll close the issue now then :)
There are a few other issues describing problems setting up this extension via docker so I thought I'd throw my hat into the ring. (see: https://github.com/SanderRonde/phpstan-vscode/issues/1, https://github.com/SanderRonde/phpstan-vscode/issues/12, https://github.com/SanderRonde/phpstan-vscode/issues/53)
For a bit of context, I am running a symfony project in docker, with the phpstan executable being within the container under
vendor/bin/phpstan
.I have these settings:
This fails with the following vague error:
...However... If I open a terminal and execute what I think this is trying to do based on the trace above:
docker exec -t REDACTED_api_php-1 /bin/sh -c /var/www/REDACTED/vendor/bin/phpstan analyse -c /var/www/REDACTED/phpstan.neon.dist --error-format=json --no-interaction --memory-limit=1G
Then it works just fine (Albeit it complains about a lack of specified paths to analyse, presumably this is passed at runtime based on file edits, vscode tabs open ect)
I would assume this docker setup would work similarly to the PHPUnit extension which appears to operate fine with the following config: