Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mix.cmd sometimes crashes with error in encoding on Windows 11 #14026

Closed
clemensm opened this issue Dec 2, 2024 · 1 comment
Closed

Mix.cmd sometimes crashes with error in encoding on Windows 11 #14026

clemensm opened this issue Dec 2, 2024 · 1 comment

Comments

@clemensm
Copy link
Contributor

clemensm commented Dec 2, 2024

Elixir and Erlang/OTP versions

Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1]

Elixir 1.17.3 (compiled with Erlang/OTP 25)

Operating system

windows 11 home

Current behavior

Hi all

We've got a Phoenix project where in the mix assets.deploy phase we copy a couple of files in the windows build using basically this line:

"cmd robocopy a b /MIR"

This is working fine when being executed manually (i.e. we've got a build.bat script), i.e. logged into the machine, running a cmd session, running the bat file. However if we execute this via Jenkins, where the same computer that we've used manually is running as a Jenkins slave, this will fail with an error:

** (ArgumentError) argument error
(stdlib 5.2.3.2) io.erl:103: :io.put_chars(:standard_io, <<32, 32, 32, 82, 79, 66, 79, 67, 79, 80, 89, 32, 32, 32, 32, 32, 58, 58, 32, 32, 32, 32, 32, 82, 111, 98, 117, 115, 116, 101, 115, 32, 68, 97, 116, 101, 105, 107, 111, 112, 105, 101, 114, 101, 110, 32, 102, 129, 114, 32, ...>>)
(elixir 1.17.3) lib/system.ex:1145: System.do_port_byte/3
(elixir 1.17.3) lib/system.ex:1131: System.do_cmd/3
(mix 1.17.3) lib/mix/shell.ex:132: Mix.Shell.cmd/3
(mix 1.17.3) lib/mix/tasks/cmd.ex:72: Mix.Tasks.Cmd.run/1
(mix 1.17.3) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
(mix 1.17.3) lib/mix/task.ex:561: Mix.Task.run_alias/6
(mix 1.17.3) lib/mix/cli.ex:96: Mix.CLI.run_task/2

After trying around a bit I stumbled upon this, which has the same error when compiling argon2_elixir (which was happening with us as well, but an update of elixir_make solved the issue):

#13637

Trying out that fix suggested by @josevalim by modifying the line mix.exs solved this problem:

"cmd cscp 65001 & robocopy a b /MIR"

So I assume that in mix there is a very similar line somewhere?

Sadly it's hard to reproduce, since you need to setup a Jenkins master server, and a Jenkins slave as well to trigger this, so I hope this information is enough to find the issue...

Happy to help if you need more info!

Expected behavior

The line should be executed without an error

josevalim added a commit that referenced this issue Dec 2, 2024
@josevalim
Copy link
Member

I sent a PR here: #14027

Can you please verify if it works? Perhaps the simplest way to do so is by:

  1. Write the contents of this file to disk: https://raw.githubusercontent.com/elixir-lang/elixir/ad5fbcfb45d0d41d75fb825cc01ee0dc97fdae43/lib/mix/lib/mix/shell/io.ex

  2. Run elixirc path/to/file.ex

  3. It will output a Elixir.Mix.Shell.IO.beam, which you can now copy to the lib/mix/ebin directory of your installation (it should replace a file)

And then run the command again and let me know if it works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants