Hello,
I’d like to run some tasks with env variables specified (MIX_ENV=test), but with current configuration it fails whenever I set this variable.
mix.exs:
config.exs:
mix git_hooks.run pre_commit:
Maybe someone has to face with similar problem?
Thanks!
Can you show the full error of mix ecto.reset
? Preferably with text and not screenshots, too.
1 Like
That’s all I see after running mix git_hooks.run pre_commit
. This is whole error message.
mix ecto.reset
or MIX_ENV=test mix ecto.reset
works absolutely fine. The problem is to set test env in hook.
This is confusing. Your OP shows that the reset command has failed?
Excuse me, could you expand the abbreviation “OP”?
Yes, it fails when I run it as git hook with env: [“MIX_ENV”, “test”]. Without this option it works fine. It doesn’t matter if it’s ecto.reset or any other command. Every task with environment variable fail.
Some examples:
mix ecto.reset
- works
MIX_ENV=test mix ecto.reset
- works
mix git_hooks.run pre_commit
without specified env - works
mix git_hooks.run pre_commit
with env option - fail
I see. But can’t you provide more details of the error? Surely when you run the task in the terminal there’s something more than “execution failed”?
Then it seems that the code that runs those tasks is cutting the output. Why don’t you run all these one by one by yourself? Then the first one that fails should have more error details available in the terminal.
Because without that I’m not sure that we can help you.
There is no more output. Every single task run by myself in terminal just works. It fails only in one case - when I use git_hooks with env option. I sent all output provided. I have not more information about this failure.
Then I am afraid you’ll have to delve into the source of git_hooks
.
Oh, it was my mistake. I just realized that I wrote env: ["MIX_ENV", "test"]
instead of env: [{"MIX_ENV", "test"}]
.
2 Likes