From 402ef86f4b94dd5b7ed80206f03010071e0e37d2 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Sun, 14 Apr 2024 17:37:02 +0300 Subject: [PATCH] Added error-check on terminal restoration --- cpm/cpm_syscalls.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cpm/cpm_syscalls.go b/cpm/cpm_syscalls.go index e2e7303..b06772d 100644 --- a/cpm/cpm_syscalls.go +++ b/cpm/cpm_syscalls.go @@ -36,7 +36,10 @@ func SysCallReadChar(cpm *CPM) error { } // restore the state of the terminal to avoid mixing RAW/Cooked - term.Restore(int(os.Stdin.Fd()), oldState) + err = term.Restore(int(os.Stdin.Fd()), oldState) + if err != nil { + return fmt.Errorf("error restoring terminal state %s", err) + } // Return the character cpm.CPU.States.AF.Hi = b[0]