mirror of
https://github.com/kemko/xc.git
synced 2026-01-01 15:55:43 +03:00
negative delays and delay int size fixed
This commit is contained in:
@@ -273,14 +273,18 @@ func (c *Cli) doAlias(name string, argsLine string, args ...string) {
|
||||
|
||||
func (c *Cli) doDelay(name string, argsLine string, args ...string) {
|
||||
if len(args) < 1 {
|
||||
term.Errorf("Usage: delay <seconds>\n")
|
||||
term.Warnf("Current delay value: %d\n", c.delay)
|
||||
return
|
||||
}
|
||||
sec, err := strconv.ParseInt(args[0], 10, 8)
|
||||
sec, err := strconv.ParseInt(args[0], 10, 32)
|
||||
if err != nil {
|
||||
term.Errorf("Invalid delay format: %s\n", err)
|
||||
return
|
||||
}
|
||||
if sec < 0 {
|
||||
term.Errorf("Invalid delay format: delay can't be negative\n")
|
||||
return
|
||||
}
|
||||
c.delay = int(sec)
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ func read(filename string, secondPass bool) (*XCConfig, error) {
|
||||
cfg.SSHConnectTimeout = ctimeout
|
||||
|
||||
delay, err := props.GetInt("executer.delay")
|
||||
if err != nil {
|
||||
if err != nil || delay < 0 {
|
||||
delay = defaultDelay
|
||||
}
|
||||
cfg.Delay = delay
|
||||
|
||||
Reference in New Issue
Block a user