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.
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 NewPrompt
withNewStandardInputParser
, which, for posix OS callssyscall.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 theNew
function.