eio icon indicating copy to clipboard operation
eio copied to clipboard

support for creating ptys and a login_tty fork_action

Open avsm opened this issue 1 year ago • 1 comments

Just a draft to figure out the right way to support spawning a shell with a pty:

  • [ ] do the pty fds need to created as cloexec, and then inherited in a fork_action to the subshell? Right now they are not cloexec, but there is no close Fork_action and so there is too much open on the other side.
  • [x] we use login_tty as a compromise between manually doing the tty setup ourselves, and do not need low-level bindings to setsid and other terminal manipulation bits.
  • [ ] unsure how to expose this more portably in Eio, as right now Fork_actions require a direct dependency on either Eio_linux or Eio_posix, and cannot be called via Eio_unix. See https://github.com/avsm/eeww/commit/3cbac4c5142727f0cd28f6e0babb57b4b5e3c3e4#diff-81dfb4951962ecf602592af852995decc04ccce063dd78977949ed086c803adfR45 for some code that mimics Eio.Process.spawn, but with a pty. Should this plumbed through Eio.Process.spawn somehow?
  • [ ] still need to add tests
  • [ ] only Linux at the moment, need to do the configure bits to work on macOS/*BSD

/cc @RyanGibb

avsm avatar May 28 '23 16:05 avsm