Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Provide a way to evaluate a file with code #438

Closed
lukebakken opened this issue Jun 30, 2020 · 5 comments · Fixed by #441
Closed

Provide a way to evaluate a file with code #438

lukebakken opened this issue Jun 30, 2020 · 5 comments · Fixed by #441
Assignees
Milestone

Comments

@lukebakken
Copy link
Contributor

Currently you are forced to get shell quoting exactly right, which is very difficult due to the interaction between Erlang syntax and shell quoting rules. On Windows, this becomes even more difficult.

The eval subcommand should be able to read Erlang clauses from a file and execute them.

@michaelklishin
Copy link
Member

I think a new command, e.g. eval_file [path] would be best.

@gerhard
Copy link
Contributor

gerhard commented Jun 30, 2020

Would it make sense for rabbitmqctl eval to work with STDIN?

If yes, then this could be used in a number of ways, including part of a UNIX pipeline:

[SOME CODE] | [MORE CODE] | rabbitmqctl eval

cat FILE | rabbitmqctl eval

rabbitmqctl eval < FILE

rabbitmqctl eval <<< [STRING_AS_STDIN]

By the way, how does STDIN work on Windows?

@michaelklishin
Copy link
Member

Supporting stdin is also a good idea.

@michaelklishin michaelklishin changed the title "rabbitmqctl eval" should be able to take a file as input Provide a way to evaluate a file with code Jun 30, 2020
@michaelklishin michaelklishin self-assigned this Jun 30, 2020
@michaelklishin michaelklishin added this to the 3.8.6 milestone Jun 30, 2020
@lukebakken
Copy link
Contributor Author

By the way, how does STDIN work on Windows

cmd.exe supports pipes, and powershell probably has better options, but the best way on Windows will be to read a file.

@michaelklishin
Copy link
Member

This is why I think we should both add a new command to eval a file and support stdin for the command we have.

michaelklishin added a commit that referenced this issue Jul 1, 2020
for evaluation of scripts in environments where standard input
redirection is not an option or problematic, e.g.
certain Windows environments.

Closes #438
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants