In snapcraft, if you create the hook through a part, command-chain will be properly setup with the right environment, the hooks need logic to install to $SNAPCRAFT_PART_INSTALL/snap/hooks/<hook-name>
The case you are presenting is probably the case where you just add hooks to <project_root>/snap/hooks which get straight up copied into <snap_root>/meta/hooks. This can be solved by setting a global environment.
In snapcraft, if you create the hook through a part, command-chain will be properly setup with the right environment, the hooks need logic to install to $SNAPCRAFT_ PART_INSTALL/ snap/hooks/ <hook-name>
The case you are presenting is probably the case where you just add hooks to <project_ root>/snap/ hooks which get straight up copied into <snap_root> /meta/hooks. This can be solved by setting a global environment.
The fact that the environment keyword at the root of a project is not respected was a snapd issue that has since been solved https:/ /github. com/snapcore/ snapd/pull/ 5498
I am marking the snapcraft issue as Invalid for such reason, and will let the snapd team attest to what I wrote and triage appropriately.