diff --git a/README.md b/README.md index 45fe1ad..e91340f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ CLI client for [osfci.tech](https://osfci.tech), HPE's remote OpenBMC development platform (part of the [Open System Firmware CI](https://github.com/opencomputeproject/OSF-OSFCI) project). Allocate physical HPE ProLiant Gen11 servers, flash firmware, access serial consoles, and control power — all from the terminal. +> **Note**: Microsoft Windows support requires a build from source process. + ## Install ```bash @@ -198,7 +200,7 @@ curl -sk -u root:0penBmc \ The CLI communicates with the OSFCI gateway at `osfci.tech`: -``` +```text osfci-cli --(HTTPS)--> osfci.tech gateway --(HTTP)--> controller node | | | reverse proxy (port 443) | EM100 emulators diff --git a/internal/console/bmcweb.go b/internal/console/bmcweb.go index 94022b3..8ea7926 100644 --- a/internal/console/bmcweb.go +++ b/internal/console/bmcweb.go @@ -73,10 +73,6 @@ func (s *BMCWebSession) Run() error { s.oldState = oldState defer s.restore() - sigCh := make(chan os.Signal, 1) - signal.Notify(sigCh, syscall.SIGWINCH) - defer signal.Stop(sigCh) - intCh := make(chan os.Signal, 1) signal.Notify(intCh, syscall.SIGINT, syscall.SIGTERM) defer signal.Stop(intCh) diff --git a/internal/console/resize_signal_unix.go b/internal/console/resize_signal_unix.go new file mode 100644 index 0000000..65f091e --- /dev/null +++ b/internal/console/resize_signal_unix.go @@ -0,0 +1,17 @@ +//go:build !windows + +package console + +import ( + "os" + "os/signal" + "syscall" +) + +func notifyResizeSignal(ch chan<- os.Signal) { + signal.Notify(ch, syscall.SIGWINCH) +} + +func isResizeSignal(sig os.Signal) bool { + return sig == syscall.SIGWINCH +} diff --git a/internal/console/resize_signal_windows.go b/internal/console/resize_signal_windows.go new file mode 100644 index 0000000..f889390 --- /dev/null +++ b/internal/console/resize_signal_windows.go @@ -0,0 +1,14 @@ +//go:build windows + +package console + +import "os" + +func notifyResizeSignal(ch chan<- os.Signal) { + _ = ch +} + +func isResizeSignal(sig os.Signal) bool { + _ = sig + return false +} diff --git a/internal/console/ttyd.go b/internal/console/ttyd.go index 6d29cbc..0b1ef10 100644 --- a/internal/console/ttyd.go +++ b/internal/console/ttyd.go @@ -131,9 +131,9 @@ func (s *Session) Run() error { s.oldState = oldState defer s.restore() - // Handle SIGWINCH for terminal resize. + // Handle terminal resize signal where supported. sigCh := make(chan os.Signal, 1) - signal.Notify(sigCh, syscall.SIGWINCH) + notifyResizeSignal(sigCh) defer signal.Stop(sigCh) // Handle SIGINT/SIGTERM gracefully. @@ -164,7 +164,7 @@ func (s *Session) Run() error { for { select { case sig := <-sigCh: - if sig == syscall.SIGWINCH { + if isResizeSignal(sig) { s.sendResize() } case <-intCh: