packer: Ui requires input for Ctrl-C

This commit is contained in:
Mitchell Hashimoto 2013-06-14 17:37:38 -07:00
parent 4c1873d1f3
commit 22e7345148
2 changed files with 11 additions and 8 deletions

View File

@ -210,7 +210,6 @@ func (c Command) Run(env packer.Environment, args []string) int {
}
}
// Wait for both the builds to complete and the interrupt handler,
// if it is interrupted.
log.Printf("Waiting on builds to complete...")

View File

@ -124,16 +124,20 @@ func (rw *ReaderWriterUi) Ask(query string) string {
result <- line
}()
for {
select {
case line := <-result:
return line
case <-sigCh:
log.Println("Interrupt during Ask call. Returning immediately.")
fmt.Fprintln(rw.Writer)
return ""
fmt.Fprint(
rw.Writer,
"\nInterrupts are blocked while waiting for input. Press enter.")
}
}
return ""
}
func (rw *ReaderWriterUi) Say(message string) {
rw.l.Lock()
defer rw.l.Unlock()