diff options
| author | Chris Lu <chris.lu@uber.com> | 2021-04-14 01:33:21 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@uber.com> | 2021-04-14 01:33:21 -0700 |
| commit | 90677e1097e18567999d98436d8c1e8eba4cc611 (patch) | |
| tree | 644eaf4d6071f5f95c3e3ef753756962719252a2 /weed/shell/shell_liner.go | |
| parent | 3f3268cd1bb8c2824864b9293d419649285f435c (diff) | |
| download | seaweedfs-90677e1097e18567999d98436d8c1e8eba4cc611.tar.xz seaweedfs-90677e1097e18567999d98436d8c1e8eba4cc611.zip | |
ensure to call line.Close()
fix https://github.com/chrislusf/seaweedfs/issues/1995
similar to https://github.com/peterh/liner/issues/104
Diffstat (limited to 'weed/shell/shell_liner.go')
| -rw-r--r-- | weed/shell/shell_liner.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/weed/shell/shell_liner.go b/weed/shell/shell_liner.go index d79f67032..1dd611ca5 100644 --- a/weed/shell/shell_liner.go +++ b/weed/shell/shell_liner.go @@ -2,6 +2,7 @@ package shell import ( "fmt" + "github.com/chrislusf/seaweedfs/weed/util/grace" "io" "os" "path" @@ -25,6 +26,9 @@ func RunShell(options ShellOptions) { line = liner.NewLiner() defer line.Close() + grace.OnInterrupt(func() { + line.Close() + }) line.SetCtrlCAborts(true) |
