Skip to content

Commit 497277a

Browse files
committed
Include Shutdown frame for arm64 / cloud-hypervisor
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 6b8a1fe commit 497277a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

main.go

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ var (
2121
const (
2222
FrameTypeData = 0x01
2323
FrameTypeWindowSize = 0x02
24+
FrameTypeShutdown = 0x03
2425
)
2526

2627
func main() {
@@ -229,6 +230,13 @@ func handleConnection(conn net.Conn) {
229230
pty.Setsize(ptty, &ws)
230231
log.Printf("Resized PTY to %dx%d", width, height)
231232
}
233+
case FrameTypeShutdown:
234+
log.Printf("Received shutdown command, executing reboot")
235+
rebootCmd := exec.Command("reboot")
236+
if err := rebootCmd.Run(); err != nil {
237+
log.Printf("Error executing reboot: %v", err)
238+
}
239+
return
232240
default:
233241
log.Printf("Unknown frame type: %d", frameType)
234242
}

0 commit comments

Comments
 (0)