Some work on supporting Windows

This commit is contained in:
AlexSSD7 2023-08-28 11:35:57 +02:00
commit 2f1d4ae60d
9 changed files with 109 additions and 19 deletions

View file

@ -4,6 +4,7 @@ import (
"context"
"log/slog"
"os"
"runtime"
"strings"
"github.com/AlexSSD7/linsk/vm"
@ -70,7 +71,13 @@ var shellCmd = &cobra.Command{
}
}()
termWidth, termHeight, err := term.GetSize(termFD)
termFDGetSize := termFD
if runtime.GOOS == "windows" {
// Another Windows workaround :/
termFDGetSize = int(os.Stdout.Fd())
}
termWidth, termHeight, err := term.GetSize(termFDGetSize)
if err != nil {
slog.Error("Failed to get terminal size", "error", err)
return 1