From 90677e1097e18567999d98436d8c1e8eba4cc611 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 14 Apr 2021 01:33:21 -0700 Subject: [PATCH] ensure to call line.Close() fix https://github.com/chrislusf/seaweedfs/issues/1995 similar to https://github.com/peterh/liner/issues/104 --- weed/shell/shell_liner.go | 4 ++++ 1 file changed, 4 insertions(+) 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)