mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-26 17:53:59 -04:00
packer: Ui requires input for Ctrl-C
This commit is contained in:
@@ -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...")
|
||||
|
||||
+11
-7
@@ -124,14 +124,18 @@ func (rw *ReaderWriterUi) Ask(query string) string {
|
||||
result <- line
|
||||
}()
|
||||
|
||||
select {
|
||||
case line := <-result:
|
||||
return line
|
||||
case <-sigCh:
|
||||
log.Println("Interrupt during Ask call. Returning immediately.")
|
||||
fmt.Fprintln(rw.Writer)
|
||||
return ""
|
||||
for {
|
||||
select {
|
||||
case line := <-result:
|
||||
return line
|
||||
case <-sigCh:
|
||||
fmt.Fprint(
|
||||
rw.Writer,
|
||||
"\nInterrupts are blocked while waiting for input. Press enter.")
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func (rw *ReaderWriterUi) Say(message string) {
|
||||
|
||||
Reference in New Issue
Block a user