Merge pull request #4269 from mitchellh/4268
fix wait boot_command regex.
This commit is contained in:
commit
a27446b54f
|
@ -144,6 +144,7 @@ func vncSendString(c *vnc.ClientConn, original string) {
|
|||
special["<rightShift>"] = 0xFFE2
|
||||
|
||||
shiftedChars := "~!@#$%^&*()_+{}|:\"<>?"
|
||||
waitRe := regexp.MustCompile(`^<wait([0-9hms]+)>`)
|
||||
|
||||
// TODO(mitchellh): Ripe for optimizations of some point, perhaps.
|
||||
for len(original) > 0 {
|
||||
|
@ -339,16 +340,13 @@ func vncSendString(c *vnc.ClientConn, original string) {
|
|||
continue
|
||||
}
|
||||
|
||||
if strings.HasPrefix(original, "<wait") && strings.HasSuffix(original, ">") {
|
||||
re := regexp.MustCompile(`<wait([0-9hms]+)>$`)
|
||||
dstr := re.FindStringSubmatch(original)
|
||||
if len(dstr) > 1 {
|
||||
log.Printf("Special code %s found, sleeping", dstr[0])
|
||||
if dt, err := time.ParseDuration(dstr[1]); err == nil {
|
||||
time.Sleep(dt)
|
||||
original = original[len(dstr[0]):]
|
||||
continue
|
||||
}
|
||||
waitMatch := waitRe.FindStringSubmatch(original)
|
||||
if len(waitMatch) > 1 {
|
||||
log.Printf("Special code %s found, sleeping", waitMatch[0])
|
||||
if dt, err := time.ParseDuration(waitMatch[1]); err == nil {
|
||||
time.Sleep(dt)
|
||||
original = original[len(waitMatch[0]):]
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue