Skip to content

Conversation

@jcpetruzza
Copy link
Contributor

Summary:

Context

The DAP server communicates with the client via a pipe on stdin/stdout. The protocol uses \r\n to delimit frames

Problem

By default stdin/stdout are in text mode, and when we create a port in edb_dap_transport, even though we specify binary for the port, the underlying devices are already in text mode, so all \r are converted by default to \n.

This then means that the parsing of DAP frames fail, as we don't get the \r\n\rn pattern that we expect

This diff

Set stdio/stdout to binary mode before opening the port

Differential Revision: D81579173

Summary:
# Context
The DAP server communicates with the client via a pipe on stdin/stdout. The protocol uses `\r\n` to delimit frames

# Problem
By default stdin/stdout are in text mode, and when we create a port in `edb_dap_transport`, even though we specify `binary` for the port, the underlying devices are already in `text` mode, so all `\r` are converted by default to `\n`.

This then means that the parsing of DAP frames fail, as we don't get the `\r\n\rn` pattern that we expect

# This diff
Set stdio/stdout to binary mode before opening the port

Differential Revision: D81579173
@meta-cla meta-cla bot added the cla signed label Sep 3, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81579173

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 4a4610f.

jcpetruzza added a commit that referenced this pull request Sep 11, 2025
Summary:
Pull Request resolved: #11

# Context
The DAP server communicates with the client via a pipe on stdin/stdout. The protocol uses `\r\n` to delimit frames

# Problem
By default stdin/stdout are in text mode, and when we create a port in `edb_dap_transport`, even though we specify `binary` for the port, the underlying devices are already in `text` mode, so all `\r` are converted by default to `\n`.

This then means that the parsing of DAP frames fail, as we don't get the `\r\n\r\n` pattern that we expect

# This diff
Set stdio/stdout to binary mode before opening the port

Reviewed By: TheGeorge, robertoaloi

Differential Revision: D81579173

fbshipit-source-id: 4ff329ad2a01e6fa96db24d66147373572420808
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants