Skip to content

Use O_NOCTTY flag in .NET APIs that open files. #129156

Closed

Description

@tmds

File and FileStream are currently not including the O_NOCTTY flag when opening files on Unix. Without this flag, if the process has no controlling terminal and the path that is opened is a terminal, it becomes the controlling terminal.

This is probably not what the user is expecting and it may introduce issues. For example, opening a serial port device which then gets disconnected would send a hangup signal to the .NET process which will terminate the process.

@adamsitnik ptal.

Activity

  1. adamsitnik commented on Jun 9, 2026

    @adamsitnik
    Member

    @tmds it sounds very reasonable, would you like to send a PR?

  2. added this to the 11.0.0 milestone on Jun 9, 2026
  3. tmds commented on Jun 9, 2026

    @tmds
    MemberAuthor

    Sure!

  4. added a commit that references this issue on Jun 12, 2026
    4c74f6a
  5. locked and limited conversation to collaborators on Jul 12, 2026
  6. added a commit that references this issue on Jul 15, 2026
    f09647e
  7. added a commit that references this issue on Jul 22, 2026
    76ab762
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions