From d9c4b8a94cec195e0a0bfb5b45c8bd7bba5aea04 Mon Sep 17 00:00:00 2001 From: Kleissner Date: Sat, 11 Dec 2021 19:55:22 +0100 Subject: [PATCH] Add explicit exit command. Close #11 --- Command Line.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Command Line.go b/Command Line.go index 626af1c..08e5e56 100644 --- a/Command Line.go +++ b/Command Line.go @@ -13,6 +13,7 @@ import ( "fmt" "io" "net" + "os" "sort" "strconv" "strings" @@ -46,6 +47,7 @@ func showHelp(output io.Writer) { "dht store Store data into DHT\n"+ "get block Get block from remote peer\n"+ "log error Set error log output\n"+ + "exit Exit\n"+ "\n") } @@ -440,6 +442,9 @@ func userCommands(input io.Reader, output io.Writer, terminateSignal chan struct go blockTransfer(peer, uint64(blockNumber)) + case "exit": + core.Filters.LogError("userCommands", "graceful exit via user terminal command\n") + os.Exit(core.ExitGraceful) } } }