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

Handle blank Mix target values properly #11603

Closed

Conversation

mnishiguchi
Copy link
Contributor

@mnishiguchi mnishiguchi commented Jan 31, 2022

This addresses whitespace or empty string accidentally passed into Mix.target/1.

Changes

  • Let Mix.target/1 accept a string value
  • Let Mix.target/1 handle whitespace properly
    • trim whitespece
    • do nothing for a blank string

Notes

  • Currently users are responsible to validate and create an atom when calling
    Mix.target/1, which is error-prone. For example, :"" can sneak in easily.
  • One advantage of Mix.target/1 accepting a string is that we can standardize on converting a string Mix target value to atom properly.
  • discussed with @fhunleth at Mix.target() is :"" for ElixirLS nerves-project/nerves#694

@josevalim
Copy link
Member

Hi @mnishiguchi! This has been proposed in the past but we don't think it should be the job of Elixir to work around this issue. If something is setting MIX_TARGET to an empty string, then our preference would be to see it addressed. :) In any case, thank you for the PR!

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

Successfully merging this pull request may close these issues.

2 participants