+
Skip to content

Conversation

pileghoff
Copy link
Collaborator

@pileghoff pileghoff commented Jun 17, 2023

This change is needed (as far as i can tell), in order to use stdin and stdout as the interface for the debug adapter. I have tested with vscode and confirmed that this fixes the following errors:

  • Input was not being read, as there is no newline seperator after the content.
  • Output was not being flushed (on my machine), likely because there is no newline.

I decided the easiest thing to do was to combine the Sep and Content states, and read the content based on content-length, while keeping the rest of the loop based on read_line.

I'm still new to rust and what is considered best practices, so please point any mistakes or inefficiencies (especially error handling trips me up)

Edit: The reason the testinput file works is because read_line also terminates at EOF.

@pileghoff pileghoff changed the title No newline breaks read and write Read content based on content-length and do not rely on newlines Jun 17, 2023
Copy link
Owner

@sztomi sztomi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks pretty good. I have some cosmetic suggestions and a question about the utf-8 validity.

@pileghoff pileghoff requested a review from sztomi June 24, 2023 09:24
@pileghoff
Copy link
Collaborator Author

Thanks for the feedback, its much appreciated 😀

@sztomi sztomi merged commit 4fa38f1 into sztomi:main Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载