While working on https://github.com/elixir-lsp/vscode-elixir-ls/pull/154 I discovered a small issue in command line parameter handling
elixir -e ""
** (TokenMissingError) nofile:1:3 missing terminator: "
It works as expected on macOS and linux.
I realise that it's not a very useful feature. In vscode-elixir-ls it is used to test if elixir command is in PATH and behaves properly. In this particular case it could be easily replaced with e.g. elixir --version but looking into elixir.bat i can see other params are being handled in the same way.
Proper handling of empty strings
Are we sure this isn't just a particularity of the windows shell? Elixir receives the command line argument as they are passed from the OS. If the OS passes down "" as " there isn't much we can do.
@ericmj my windows cmd knowledge is rusty but params are being parsed by elixir.bat https://github.com/elixir-lang/elixir/blob/36d12b4bd4d26533c216e935903206cc3502200f/bin/elixir.bat#L100
BTW this bug is reproducible both in cmd and powershell terminal
%~1 causes %1 to expand thus removing any surrounding quotes
https://github.com/elixir-lang/elixir/blob/36d12b4bd4d26533c216e935903206cc3502200f/bin/elixir.bat#L101
Changing
set "VAR=%~1"
rem to this
set "VAR=%1"
Makes the error go away, I don't know how viable this is since I don't use Elixir, just wanted to point that.
Most helpful comment
%~1 causes %1 to expand thus removing any surrounding quotes
https://github.com/elixir-lang/elixir/blob/36d12b4bd4d26533c216e935903206cc3502200f/bin/elixir.bat#L101
Changing
Makes the error go away, I don't know how viable this is since I don't use Elixir, just wanted to point that.