Open wingyplus opened 2 years ago
@wingyplus I don't have a chance to test this since I don't have a Windows machine. Are you willing to give figuring this out a try? 🙃
Just a little investigation. Inspecting rest
inside decoder.ex with this diff:
diff --git a/lib/protobuf/decoder.ex b/lib/protobuf/decoder.ex
index 2fa107e..2febe12 100644
--- a/lib/protobuf/decoder.ex
+++ b/lib/protobuf/decoder.ex
@@ -42,6 +42,9 @@ defmodule Protobuf.Decoder do
field_number = bsr(value, 3)
wire_type = band(value, 0b00000111)
+ IO.inspect(:stderr, byte_size(rest), [])
+ IO.inspect(:stderr, rest, binaries: :as_binaries)
+
if field_number != 0 do
handle_field(rest, field_number, wire_type, message, props)
else
This is the result when I'm running on Windows:
I'm encountering the same issue and having a hard time tracking down where the issue could be during decoding.
value: 50
field_number: 6
wire_type: 2
bytes left: 62
<<46, 46, 103, 111, 111, 103, 108, 101, 46, 112, 114, 111, 116, 111, 98, 117,
102, 46, 68, 101, 115, 99, 114, 105, 112, 116, 111, 114, 80, 114, 111, 116,
111, 46, 82, 101, 115, 101, 114, 118, 101, 100, 82, 97, 110, 103, 101, 82, 10,
114, 101, 115, 101, 114, 118, 101, 100, 82, 97, 110, 103, 101>>
---------------------------
value: 82
field_number: 10
wire_type: 2
bytes left: 14
<<10, 114, 101, 115, 101, 114, 118, 101, 100, 82, 97, 110, 103, 101>>
---------------------------
value: 110
field_number: 13
wire_type: 6
bytes left: 2
<<103, 101>>
** (Protobuf.DecodeError) cannot decode binary data, unknown wire type: 6
(protobuf 0.12.0) lib/protobuf/decoder.ex:88: Protobuf.Decoder.handle_field/5
(protobuf 0.12.0) lib/protobuf/decoder.ex:17: Protobuf.Decoder.decode/2
If I run
mix test
on Windows, the project will raise error:After I investigate, I found that
mix escript.build
generate only unix shell script that run escript binary but not for Windows shell script. I try temporary by createprotoc-gen-elixir.bat
:NOTE: I copied this script from
mix escript.install
.And modify
mix.exs
with:After run
mix test
will change to: