Skip to content

Mix cmd in alias no longer supports globs #14506

@kenny-evitt

Description

@kenny-evitt

Elixir and Erlang/OTP versions

Erlang/OTP 27 [erts-15.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Elixir 1.19.0-dev (ea2ae22) (compiled with Erlang/OTP 27)

Operating system

macOS 14.1.2 (23B92)

Current behavior

Example alias from mix.exs:

  defp aliases do
    [
      cp_test: [
        "cmd cp -R web/static/assets/* priv_test/static"
      ],
      ...
    ]
  end

Running the alias:

$ mix cp_test
cp: web/static/assets/*: No such file or directory
** (exit) 1
    (mix 1.19.0-dev) lib/mix/tasks/cmd.ex:82: Mix.Tasks.Cmd.run/1
    (mix 1.19.0-dev) lib/mix/task.ex:499: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.19.0-dev) lib/mix/task.ex:573: Mix.Task.run_alias/6
    (mix 1.19.0-dev) lib/mix/cli.ex:131: Mix.CLI.run_task/2
    /Users/kenny/.asdf/installs/elixir/main-otp-27/bin/mix:7: (file)

Expected behavior

In (some) previous Elixir versions, the same alias works as expected. It definitely works in 1.13.4.

The only workaround – to run cp with a glob (or at least *) – that I've found is to move the cp command to a shell script and modify the alias to run the script via a shell program, example:

  defp aliases do
    [
      cp_test: [
        "cmd bash cp_test.bash"
      ],
      ...
    ]
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions