Open hlampert opened 5 years ago
Unfortunately I'm not able to test on Windows at the moment, and it's not clear to me how you are invoking the release script (from conhost? from powershell?) and what the arguments are. From glancing through the scripts, I don't see anywhere that we are duplicating argument lists, but it may be some implicit behavior in powershell. Unfortunately command line argument parsing on Windows is a nightmare :(
Steps to reproduce
Create a custom command that accepts parameters - for example: GetTagHistory.ReleaseTasks.process, with appropriate process function and process.ps1 file.
From a command prompt, call the command with parameters, for example: set "COOKIE=SOME_SECRET_COOKIE" && dl_posbypass_umbrella process --location mylocation --tagfile tagfile.txt
Get parameter list in process function that looks like either an empty list (if Release-Ctl eval --mfa "GetTagHistory.ReleaseTasks.process/1" --argv -- "$args" is called), or something strange like ["mylocation", "mylocation", "--tagfile", "tagFile.txt", "--location", "mylocation", "--tagfile", "tagFile.txt", "--location", "mylocation", "--tagfile", "tagFile.txt"]' if Release-Ctl is called with Release-Ctl eval --mfa "GetTagHistory.ReleaseTasks.process/1" --argv -- $args (No quotes around the $args).
Verbose Logs
Paste the output of the release command you ran with the
--verbose
flag below in the summary tags (this helps keep the issue easy to navigate):(Sorry, this doesn't work for me)
Description of issue
What are the expected results? parameter list received by process function is ["--location","mylocation", "--tagfile", "tagfile.txt"]
What version of Distillery? 2.0.12
What OS, Erlang/Elixir versions are you seeing this issue on? Windows Server 2016/10, Erlang/OTP 21 (ERTS 10.2) , Elixir 1.8
If possible, also provide your
rel/config.exs
, as it is often my first troubleshooting question, and you'll save us both time :)use Mix.Releases.Config,
This sets the default release built by
mix release
For a full list of config options for both releases
and environments, visit https://hexdocs.pm/distillery/config/distillery.html
You may define one or more environments in this file,
an environment's settings will override those of a release
when building in that environment, this combination of release
and environment configuration is called a profile
environment :dev do
If you are running Phoenix, you should make sure that
server: true is set and the code reloader is disabled,
even in dev mode.
It is recommended that you build with MIX_ENV=prod and pass
the --env flag to Distillery explicitly if you want to use
dev mode.
set dev_mode: true set include_erts: false set cookie: :""
end
environment :prod do
set include_erts: true
set include_erts: "C:/Program Files/erl10.2" set include_src: false set cookie: :":E|Z!Qf=.$S!o4c$F_h7NV{th71pn16Fu_M==}wxMd>d.1SVD&|mNNH7Wr`H}^" set vm_args: "rel/vm.args" end
You may define one or more releases in this file.
If you have not set a default release, or selected one
when running
mix release
, the first release in the filewill be used by default
release :dl_posbypass_umbrella do set version: "0.1.0" set applications: [ :runtime_tools, dl_posbypass_gettaghistory: :permanent, dl_posbypass_gettaghistory_consoleio: :permanent ] set commands: [ process: "rel/commands/win/process.ps1" ] set overlays: [ {:mkdir, "releases/<%= release_version %>/commands/win"}, {:copy, "rel/commands/win/process.ps1", "releases/<%= release_version %>/commands/win/process.ps1"} ] end
Write-Host "Running process command..." Write-host "args: '$($args)'" Release-Ctl eval --mfa "GetTagHistory.ReleaseTasks.process/1" --argv -- $args
Write-Host "Running process command..." Write-host "args: '$($args)'" Release-Ctl eval --mfa "GetTagHistory.ReleaseTasks.process/1" --argv -- "$args"
defmodule GetTagHistory.ReleaseTasks do
alias GetTagHistory.ConsoleIO.CLI, as: ConsoleIO
@start_apps [:dl_posbypass_gettaghistory, :retryable, :dl_posbypass_gettaghistory_consoleio]
def process(my_args) do IO.puts "received args: '#{inspect my_args}'" start_services() ConsoleIO.main(my_args) stop_services() end
defp start_services do IO.puts("Starting dependencies...") Enum.each(@start_apps, &Application.ensure_all_started/1) end
defp stop_services do IO.puts("Stopping dependencies.") :init.stop() end end