Upon upgrading to Erlang 26, I noticed that the protoc-gen-elixir plugin to the protobuf compiler no longer works. The plugin starts off by reading :stdio as a binary stream, and decoding the contents:
# See https://groups.google.com/forum/#!topic/elixir-lang-talk/T5enez_BBTI.
:io.setopts(:standard_io, encoding: :latin1)
# Read the standard input that protoc feeds us.
bin = binread_all!(:stdio)
request = Protobuf.Decoder.decode(bin, Google.Protobuf.Compiler.CodeGeneratorRequest)
The binread_all!() function calls IO.binread(), and this succeeds sometimes, fails with {:error, :collect_chars} at other times, and reads a truncated file in yet other situations, depending on the exact input args to protoc. This all works with Erlang 25 / Elixir 1.14, and with the Python protoc plugin.
It’s a little awkward since it has to be specified at runtime, not escript build time. I think I can do the same thing with emu_args, but haven’t tried it yet.