-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IO::Hexdump for binary protocol inspection #3043
Conversation
class Hexdump | ||
include IO | ||
|
||
def initialize(@io : IO, @output : IO = STDERR, @read = false, @write = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the default output be STDOUT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's OK to use STDERR. For example today I was coding something and did ruby app.rb > data.json
and wanted to debug it at the same time. For debugging I used STDERR.puts ...
so I would get the debug data in the terminal but I would still get the output data in data.json
without mixing it with debug code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I defaulted to STDERR for this very reason.
b618685
to
bc7b95e
Compare
@asterite I get a weird error on CI:
I modified my patch to output the type of
|
@ysbaddaden Oh!! I just remembered: |
OK I'll change that. There is still something odd. For example all |
- initial 32bits hex index - separate each byte (instead of each short) - extra separator every 8 bytes
Transparent IO that prints an hexadecimal dump of read and written bytes. Mostly useful for inspecting and debugging binary protocols.
55c9445
to
ce0ffc3
Compare
done. |
@ysbaddaden I'll investigate it. Maybe some other |
@ysbaddaden Found it, it's this line which got the type from this line I think eventually it would be nice if a parent type could set the type for child methods, so we could mark I also have to check why the |
@ysbaddaden Thank you!! :-) |
Example: