summaryrefslogtreecommitdiff
path: root/vendor/github.com/chzyer/readline/readline.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-09-08 15:32:44 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-09-09 11:58:20 +0200
commiteb28a1c08469d56494006d0f2c64933ab7078d01 (patch)
treedbacf86cf194955f34f09ec56d2df284321e2ae7 /vendor/github.com/chzyer/readline/readline.go
parent7e2f002b0751c2c24e9c243495cbc313d0c3c103 (diff)
downloadpodman-eb28a1c08469d56494006d0f2c64933ab7078d01.tar.gz
podman-eb28a1c08469d56494006d0f2c64933ab7078d01.tar.bz2
podman-eb28a1c08469d56494006d0f2c64933ab7078d01.zip
update buildah and c/common to latest
also includes bumps for c/storage and c/image Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'vendor/github.com/chzyer/readline/readline.go')
-rw-r--r--vendor/github.com/chzyer/readline/readline.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/vendor/github.com/chzyer/readline/readline.go b/vendor/github.com/chzyer/readline/readline.go
index 0e7aca06d..63b917101 100644
--- a/vendor/github.com/chzyer/readline/readline.go
+++ b/vendor/github.com/chzyer/readline/readline.go
@@ -17,7 +17,9 @@
//
package readline
-import "io"
+import (
+ "io"
+)
type Instance struct {
Config *Config
@@ -270,14 +272,24 @@ func (i *Instance) ReadSlice() ([]byte, error) {
}
// we must make sure that call Close() before process exit.
+// if there has a pending reading operation, that reading will be interrupted.
+// so you can capture the signal and call Instance.Close(), it's thread-safe.
func (i *Instance) Close() error {
+ i.Config.Stdin.Close()
+ i.Operation.Close()
if err := i.Terminal.Close(); err != nil {
return err
}
- i.Config.Stdin.Close()
- i.Operation.Close()
return nil
}
+
+// call CaptureExitSignal when you want readline exit gracefully.
+func (i *Instance) CaptureExitSignal() {
+ CaptureExitSignal(func() {
+ i.Close()
+ })
+}
+
func (i *Instance) Clean() {
i.Operation.Clean()
}