Elixir: mix do fails when one of the tasks has a comma in it

Created on 23 Jun 2016  路  8Comments  路  Source: elixir-lang/elixir

Debian 9 Linux
Elixir 1.3.0

As of Elixir v1.3 mix do incorrectly parses arguments when a task contains a comma.

Example:

mix do run -e "[1, 2]"

Before this was interpreted as one task (run -e "[1, 2]"), but now it is incorrectly interpreted as 2 (run -e "[1 and 2]), which is a syntax error.

louis ~/tmp/foo $ mix do run -e "[1, 2]"
Compiling 1 file (.ex)
Generated foo app
** (TokenMissingError) nofile:1: missing terminator: ] (for "[" starting at line 1)
    (elixir) lib/code.ex:168: Code.eval_string/3
    (elixir) lib/enum.ex:651: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:651: Enum.each/2
    (mix) lib/mix/tasks/run.ex:67: Mix.Tasks.Run.run/1
    (mix) lib/mix/task.ex:296: Mix.Task.run_task/3
    (elixir) lib/enum.ex:651: Enum."-each/2-lists^foreach/1-0-"/2

I've been unable to find ways to escape the comma in the code literal here.

Thanks,
Louis

Mix Bug

All 8 comments

I think that's my bad :sweat: I'll take a look at it!

Thanks @tuvistavie :)

I think we have no other option besides reverting to the previous behavior
that checks for commas only at the end and then explicitly documenting it.

_Jos茅 Valim_
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R&D

@josevalim It seems to be the only solution indeed. I'll take care of it!

@tuvistavie please let us know when you get a chance at it. We want to release v1.3.1 this monday and I would likely to include this fix. :)

@josevalim I'll have time to do this tomorrow :smile:

Thanks all!

Sorry for pinging everyone, I just want to mention #4577 in this issue so that they're linked and finding this again is easier than it is now :).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

josevalim picture josevalim  路  31Comments

heiko-braun picture heiko-braun  路  27Comments

conradwt picture conradwt  路  34Comments

josevalim picture josevalim  路  44Comments

michalmuskala picture michalmuskala  路  35Comments