IO.gets and running a release in the foreground

Hi,

I made a small game for my sister in law where she has to type the french translation of a random english word. Since she doesn’t have elixir installed on her machine, I thought I could build a release with distillery and embed erts in it.

When I type mix from the root of the project, the game starts, shows a word and wait for an input (with IO.gets). I can then type my translation, press Enter and receive a feedback (success/failure).

When I type iex -S mix, the game starts, shows a word and wait for an input but anything I type doesn’t show up in my terminal. Pressing Enter doesn’t do anything either.

When I build my release and type ./rel/game/bin/game foreground, the game starts, shows a word and wait for an input. I can type an answer and press enter, it shows up in my terminal but nothing happens after I press enter: I can keep typing.

What am I missing? how can I fix it?

For the record, someone in the slack chat pointed me to https://github.com/bitwalker/distillery/issues/10

This is not what I attempted to do at first, but that will do for now.

Couldn’t you generate an escript? I don’t know out of hand if that works without installing any dependencies at all, but it looks like it should…

No, because afaik escript requires elixir or erlang to be installed on the machine.

She’s not a developer herself so I would have to install elixir on her machine which probably also means installing xcode and accepting its license agreement. Not something I want to do.

Yeah, that doesn’t seem like a good approach :slight_smile: According to the docs, however, Elixir seems to be embedded by default, unless you opt out of it.