[erlang-questions] How do I prevent escript from reading stdin?
Mon Jul 1 16:25:39 CEST 2019
On 7/1/19 1:16 PM, Roger Lipscombe wrote:
> If I paste a sequence of commands into my terminal window...
> ...then not-escript never gets run, because (afaict), some-escript ate
> all of the input. If I paste the following:
> ./some-escript </dev/null
> ...then it's fine. But that's ugly.
While this might look ugly, it has the advantage of clearly showing your
intention, even if the escript was not consuming stdin. At least if you
put code like that into a script, it will help a future reader (possibly
including the writer) a lot.
When using bash/dash, you could also explicitly just close stdin
with a similar effect but perhaps (depending on taste) less ugly. (Other shells may also have a similar feature)
More information about the erlang-questions