Skip to content

Commit

Permalink
Merge fa22c52 into ecba244
Browse files Browse the repository at this point in the history
  • Loading branch information
akoutmos committed Dec 9, 2019
2 parents ecba244 + fa22c52 commit 42c1e3d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/mix/tasks/git_hooks/run.ex
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ defmodule Mix.Tasks.GitHooks.Run do
end

defp run_task({:file, script_file, opts}, git_hook_type, git_hook_args) do
env_vars = Keyword.get(opts, :env, [])

args =
if Keyword.get(opts, :include_hook_args, false) do
git_hook_args
Expand All @@ -85,7 +87,8 @@ defmodule Mix.Tasks.GitHooks.Run do
|> Path.absname()
|> System.cmd(
args,
into: Config.io_stream(git_hook_type)
into: Config.io_stream(git_hook_type),
env: env_vars
)
end

Expand All @@ -96,6 +99,8 @@ defmodule Mix.Tasks.GitHooks.Run do
defp run_task({:cmd, command, opts}, git_hook_type, git_hook_args) when is_list(opts) do
[command | args] = String.split(command, " ")

env_vars = Keyword.get(opts, :env, [])

command_args =
if Keyword.get(opts, :include_hook_args, false) do
Enum.concat(args, git_hook_args)
Expand All @@ -106,7 +111,8 @@ defmodule Mix.Tasks.GitHooks.Run do
command
|> System.cmd(
command_args,
into: Config.io_stream(git_hook_type)
into: Config.io_stream(git_hook_type),
env: env_vars
)
|> case do
{_result, 0} ->
Expand Down

0 comments on commit 42c1e3d

Please sign in to comment.