delve: Debugged process can't read from stdin

A traced program will read its stdin from os.DevNull instead of os.Stdin, since in proctl.Launch() it is only stderr and stdout. I can’t figure out the reason for this, and simply adding proc.Stdin = os.Stdin in the Launch() function will make a simple test program behave as expected.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 19 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Adding an API to send input to the target process wouldn’t work for programs that expect their stdin to be a teletype (anything doing “curses” style UIs, or trying to turn off line discipline).

Good point.

I think a better approach would be to let the target process access whatever delve’s stdin is, if delve is in headless mode.

That’s a lot easier to handle. I’ll send out the patch later on (as I said, this allows me to learn more of delve’s internals and be more helpful in the future). Thank you!