Skip to content

proposal: x/term: make x/term functions take uintptr file descriptors instead of ints #69453

@tstirrat15

Description

@tstirrat15

Proposal Details

The documentation recommends getting the file descriptor with the following:

oldState, err := term.MakeRaw(int(os.Stdin.Fd()))

os.Stdin.Fd returns a uintptr, which can't (technically) be safely cast to an int. This appears to be because on windows, the value may be non-numeric. It isn't clear that this lib handles that case, and the use of int obscures that.

term should take a uintptr as its fd and handle cross-platform terminal behavior gracefully. If it isn't going to do that, the docs should be updated to make it clear that x/term really only applies to unix terminals.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions