Consider SIGTERM as well
Consider SIGTERM as well
This commit is contained in:
parent
c1fd48a14b
commit
5edc7dcdb3
@ -338,15 +338,12 @@ var walletImport = &cli.Command{
|
||||
if term.IsTerminal(int(os.Stdin.Fd())) {
|
||||
fmt.Print("Enter private key(not display in the terminal): ")
|
||||
|
||||
// Create a channel to receive OS signals
|
||||
sigCh := make(chan os.Signal, 1)
|
||||
// Notify the channel when SIGINT is received
|
||||
signal.Notify(sigCh, syscall.SIGINT)
|
||||
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
go func() {
|
||||
// Wait for SIGINT signal
|
||||
<-sigCh
|
||||
// Perform cleanup or other actions as needed
|
||||
fmt.Println("\nInterrupt signal received. Exiting...")
|
||||
os.Exit(1)
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user