Skip to content
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

Send DAP OutputEvents on stdout/stderr of debugged process when console is internalConsole #3094

Closed
gfszr opened this issue Aug 8, 2022 · 5 comments

Comments

@gfszr
Copy link
Contributor

gfszr commented Aug 8, 2022

Go Version: 1.18
Delve Version: 1.8.2

Current status

DAP allows sending stdout/stderr outputs back to the DAP client, by which it is shown on the debug console of the IDE. Delve spawns the debuggees with its own stdout/stderr, so the output is missing from the normal debug console. This is the desired behavior in case the terminal being used is either integratedTerminal or externalTerminal, but in the case of internalConsole, in order to allow showing the output to the user, clients required to somehow still redirect output (For example, nvim-dap-go).

Desired status

Delve would send OutputEvents of data from the debuggee's stdout/stderr if the console given is internalConsole, which would allow the DAP client to easily present it.

@aarzilli
Copy link
Member

aarzilli commented Aug 8, 2022

The problem with this is that some program will behave differently if their stdout/stderr is not a tty. It is unfortunate that DAP was designed like this.

@gfszr
Copy link
Contributor Author

gfszr commented Aug 8, 2022

@aarzilli Yet, other debug adapters do the same, even if running with a tty - debugpy for instance.
Also, this can be configurable, and not necessarily the default behaviour.

Moreover, DAP supports runInTerminal requests by which the adapter can tell the client how to execute the debuggee, so it would have a TTY.

@gfszr
Copy link
Contributor Author

gfszr commented Aug 8, 2022

The specific case in debugpy can be seen here:

 redirecting = arguments.get("console") == "internalConsole"

Redirection is decided in case the user specifies internalConsole as its terminal - by which this means that the user requested output to be redirected in the console. I agree this shouldn't be default behavior unless the user requested internalConsole, so perhaps updating this issue with "redirect output when console defined as internalConsole` suffices? @aarzilli

@gfszr gfszr changed the title Send DAP OutputEvents on stdout/stderr of debugged process Send DAP OutputEvents on stdout/stderr of debugged process when console is internalConsole Aug 10, 2022
@gfszr
Copy link
Contributor Author

gfszr commented Aug 10, 2022

I revised the issue to only send such OutputEvent's when launch configuration is internalConsole.

@aarzilli
Copy link
Member

This was implemented by #3253

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants