ensure to call line.Close()

fix https://github.com/chrislusf/seaweedfs/issues/1995

similar to https://github.com/peterh/liner/issues/104
This commit is contained in:
Chris Lu 2021-04-14 01:33:21 -07:00
parent 3f3268cd1b
commit 90677e1097

View File

@ -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)