Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] prompt.Input leaks file descriptor of "/dev/tty" #253

Open
avi-mastov opened this issue Mar 24, 2022 · 0 comments
Open

[Bug] prompt.Input leaks file descriptor of "/dev/tty" #253

avi-mastov opened this issue Mar 24, 2022 · 0 comments
Labels

Comments

@avi-mastov
Copy link

Bug reports

prompt.Input leaks file descriptor of "/dev/tty"

Expected Behavior

Close the file descriptor when the function returns.

Current Behavior and Steps to Reproduce

Each call to prompt.Input creates a New Prompt with NewStandardInputParser, which, for posix OS calls syscall.Open on "/dev/tty". The opened file descriptor is never closed, which causes a resource leak.

Context

I want to manage the input loop myself, but each time I call prompt.Input, it leaks another file descriptor. I found a workaround by creating a New Prompt and using its Input method, but I need to define a dummy executor that does nothing, just so I can call the New function.

  • Operating System: MacOS 12.3
  • Terminal Emulator: iTerm2
  • tag of go-prompt or commit revision: 0.2.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant