diff --git a/builder/qemu/step_type_boot_command.go b/builder/qemu/step_type_boot_command.go index 804f7621d..7773053c9 100644 --- a/builder/qemu/step_type_boot_command.go +++ b/builder/qemu/step_type_boot_command.go @@ -144,6 +144,7 @@ func vncSendString(c *vnc.ClientConn, original string) { special[""] = 0xFFE2 shiftedChars := "~!@#$%^&*()_+{}|:\"<>?" + waitRe := regexp.MustCompile(`^`) // 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, "") { - re := regexp.MustCompile(`$`) - 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 } }