init: update listeners when pressing <ENTER> on the serial console
This is useful when the network doesn’t come up correctly: you can connect a network cable between your computer and the gokrazy machine, press <ENTER> on the serial console and connect to gokrazy via its IPv6 link-local address (to find the address, use ping6 ff02::1%eth0).
This commit is contained in:
parent
34f12d9ada
commit
238bbfa55e
13
gokrazy.go
13
gokrazy.go
@ -8,6 +8,7 @@
|
|||||||
package gokrazy
|
package gokrazy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
@ -149,6 +150,18 @@ func Supervise(commands []*exec.Cmd) error {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
scanner := bufio.NewScanner(os.Stdin)
|
||||||
|
for scanner.Scan() {
|
||||||
|
if err := updateListeners("80"); err != nil {
|
||||||
|
log.Printf("updating listeners: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := scanner.Err(); err != nil {
|
||||||
|
log.Print(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user