syscall: SysProcAttr.Noctty only works if child's stdin is controlling terminal #53601
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
SysProcAttr.Noctty
is implemented by callingRawSyscall(SYS_IOCTL, 0, uintptr(TIOCNOTTY), 0)
before exec. TheTIOCNOTTY
ioctl is only implemented on the file descriptor of the controlling terminal, which is not necessarily attached to the child's FD 0. This means thatSysProcAttr.Noctty
only works whencmd.Stdin
is the session terminal, and it's not possible to run a child that is both without a terminal and with a functioning stdin.This came up because I am writing tests for an application that uses
/dev/tty
to interact with the user, and stdin to take input separately. I want to test what happens when/dev/tty
is not available, so I start the child withSysProcAttr.Noctty
set, and a pipe for stdin. The result is thatTIOCNOTTY
is issued on the pipe, causingoperation not supported by device
.Here's a short example.
The text was updated successfully, but these errors were encountered: