Describe the bug
When executing blt in a non-TTY environment the validate command seems to always fail. This affects the pre-push git hook.
I work with Docksal, and commands are run in interactive vs non-interactive mode by doing the following:
fin exec ... vs fin exec -T ...
fin exec will also detect if the command is being executed in a non-TTY environment (i.e. in a pre-push git commit hook), and if it is then passing -T does not need to be done.
I am also using a GUI for working with Git, which uses git on the host and not in the container.
With that bit of knowledge out of the way, here's the output generated by the hook (again, this is executed on the host):
$ git push --progress --verbose origin refs/heads/develop:refs/heads/develop --tags
Executing .git/hooks/pre-push...
> validate
> tests:composer:validate
Pushing to git@github.com:lpeabody/Metis.git
[ExecStack] composer validate --no-check-all --ansi
Validating composer.json and composer.lock...
[ExecStack] Running composer validate --no-check-all --ansi in /var/www
[32m./composer.json is valid[39m
> tests:php:lint
Linting PHP files...
[ExecStack] Done in 1.203s
> tests:phpcs:sniff:all
............................................................ 60 / 531 (11%)
............................................................ 120 / 531 (23%)
............................................................ 180 / 531 (34%)
............................................................ 240 / 531 (45%)
............................................................ 300 / 531 (56%)
............................................................ 360 / 531 (68%)
............................................................ 420 / 531 (79%)
............................................................ 480 / 531 (90%)
................................................... 531 / 531 (100%)
Time: 742ms; Memory: 14MB
> tests:yaml:lint:all
Validating yaml syntax for all custom modules and exported config...
Iterating over fileset files.yaml...
> tests:twig:lint:all
Validating twig syntax for all custom modules and themes...
All Twig files contain valid syntax.
> tests:deprecated:modules
[ExecStack] '/var/www/vendor/bin/phpcs'
[ExecStack] /var/www/vendor/bin/drupal-check -d /var/www/docroot/modules/custom
[ExecStack] Running /var/www/vendor/bin/drupal-check -d /var/www/docroot/modules/custom in /var/www
Checking for Deprecated Code in docroot/modules/custom
In Process.php line 1037:
TTY mode requires /dev/tty to be read/writable.
[ExecStack] Exit code 1 Time 0.098s
[notice] Review Deprecation warnings and re-run.
[error] Drupal Check in docroot/modules/custom failed.
check [--drupal-root [DRUPAL-ROOT]] [--format [FORMAT]] [-d|--deprecations] [-a|--analysis] [-s|--style] [--memory-limit [MEMORY-LIMIT]] [--no-progress] [--] <path> (<path>)...
For troubleshooting guidance and support, see https://docs.acquia.com/blt/support/
Your code has failed pre-push validation.
[error] Command `tests:deprecated:modules ` exited with code 1. This most likely indicates a problem with your configuration, and is not a BLT bug.
For troubleshooting guidance and support, see https://docs.acquia.com/blt/support/
Enumerating objects: 15, done.
Delta compression using up to 8 threads
Total 8 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 0% (0/5)
remote: Resolving deltas: 20% (1/5)
remote: Resolving deltas: 40% (2/5)
remote: Resolving deltas: 60% (3/5)
remote: Resolving deltas: 80% (4/5)
remote: Resolving deltas: 100% (5/5)
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
To github.com:lpeabody/Metis.git
8521973..7567d7e develop → develop
updating local tracking ref 'refs/remotes/origin/develop'
This is the contents of the pre-push hook:
#!/usr/bin/env bash
ROOT_DIR="$(pwd)/"
echo "Executing .git/hooks/pre-push..."
fin exec -T /var/www/vendor/bin/blt internal:git-hook:execute:pre-push --no-interaction
# Return the status of the last run command.
exit $?
The part that stands out is:
[ExecStack] Running /var/www/vendor/bin/drupal-check -d /var/www/docroot/modules/custom in /var/www
Checking for Deprecated Code in docroot/modules/custom
In Process.php line 1037:
TTY mode requires /dev/tty to be read/writable.
[ExecStack] Exit code 1 Time 0.098s
I checked the permissions on /dev/tty in the container and see the following:
crw-rw-rw- 1 root root 5, 0 Feb 14 15:42 /dev/tty
So, things look okay, and I'm not sure where things might be going awry.
To Reproduce
Steps to reproduce the behavior, ideally starting from a fresh install of BLT:
In a non-interactive environment, execute /path/to/vendor/blt validate.
Verify it exits with status 1.
Re-run the command in an interactive enviroment.
Verify it exits with status 0.
Expected behaviorblt validate runs consistently in interactive and non-interactive environments.
Describe the bug When executing blt in a non-TTY environment the validate command seems to always fail. This affects the pre-push git hook.
I work with Docksal, and commands are run in interactive vs non-interactive mode by doing the following:
fin exec ...
vsfin exec -T ...
fin exec
will also detect if the command is being executed in a non-TTY environment (i.e. in a pre-push git commit hook), and if it is then passing -T does not need to be done.I am also using a GUI for working with Git, which uses git on the host and not in the container.
With that bit of knowledge out of the way, here's the output generated by the hook (again, this is executed on the host):
This is the contents of the pre-push hook:
The part that stands out is:
I checked the permissions on /dev/tty in the container and see the following:
So, things look okay, and I'm not sure where things might be going awry.
To Reproduce Steps to reproduce the behavior, ideally starting from a fresh install of BLT:
/path/to/vendor/blt validate
.Expected behavior
blt validate
runs consistently in interactive and non-interactive environments.Detailed error output
blt -vvv validate
outputs a lot so I put the contents in a gist. https://gist.github.com/lpeabody/32178a032b9aebca0701a23b7d37e2dfBLT doctor output
System information