v1.27.0-a #10
@ -178,6 +178,8 @@ var DaemonCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("enabling runtime metrics: %w", err)
|
return xerrors.Errorf("enabling runtime metrics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interactive := cctx.Bool("interactive")
|
||||||
|
|
||||||
if cctx.Bool("manage-fdlimit") {
|
if cctx.Bool("manage-fdlimit") {
|
||||||
if _, _, err := ulimit.ManageFdLimit(); err != nil {
|
if _, _, err := ulimit.ManageFdLimit(); err != nil {
|
||||||
log.Errorf("setting file descriptor limit: %s", err)
|
log.Errorf("setting file descriptor limit: %s", err)
|
||||||
@ -299,8 +301,8 @@ var DaemonCmd = &cli.Command{
|
|||||||
willImportChain = true
|
willImportChain = true
|
||||||
}
|
}
|
||||||
|
|
||||||
willRemoveChain := cctx.Bool("remove-existing-chain")
|
var willRemoveChain bool
|
||||||
if willImportChain && !willRemoveChain {
|
if interactive && willImportChain && !cctx.IsSet("remove-existing-chain") {
|
||||||
// Confirm with the user about the intention to remove chain data.
|
// Confirm with the user about the intention to remove chain data.
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
fmt.Print("Importing chain or snapshot will by default delete existing local chain data. Do you want to proceed and delete? (yes/no): ")
|
fmt.Print("Importing chain or snapshot will by default delete existing local chain data. Do you want to proceed and delete? (yes/no): ")
|
||||||
@ -309,14 +311,16 @@ var DaemonCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("reading user input: %w", err)
|
return xerrors.Errorf("reading user input: %w", err)
|
||||||
}
|
}
|
||||||
userInput = strings.ToLower(strings.TrimSpace(userInput))
|
userInput = strings.ToLower(strings.TrimSpace(userInput))
|
||||||
|
switch userInput {
|
||||||
if userInput == "yes" {
|
case "yes":
|
||||||
willRemoveChain = true
|
willRemoveChain = true
|
||||||
} else if userInput == "no" {
|
case "no":
|
||||||
willRemoveChain = false
|
willRemoveChain = false
|
||||||
} else {
|
default:
|
||||||
return fmt.Errorf("invalid input. please answer with 'yes' or 'no'")
|
return fmt.Errorf("invalid input. please answer with 'yes' or 'no'")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
willRemoveChain = cctx.Bool("remove-existing-chain")
|
||||||
}
|
}
|
||||||
|
|
||||||
if willRemoveChain {
|
if willRemoveChain {
|
||||||
|
Loading…
Reference in New Issue
Block a user