Hit Ctrl-z (suspends process)
Type fg (Lets process run in foreground)
Should be seeing output continue but nothing happens
Hit ENTER a couple times I see an one * output
Hit Ctrl-C and see
After suspending sbasic using CTRL+Z the terminal resets the terminal settings. After executing fg, sbasic continues. But the terminal is not anymore in raw-mode and therefore the non-blocking input is not longer working. I added a signal handler for the signal SIGCONT, which is send after fg. When the signal is received sbasic sets the terminal to raw-mode again.
It would be great, if you could test it: Github
Thanks for the quick update! The fix works on the first try, Ctrl-Z and fg resume cleanly. Repeating the sequence on the same running process causes it to stall on the second attempt.
I made a mistake setting up the signal handler. SA_RESETHAND was set as a flag. Once a signal is detected, the signal handler for this signal will be reset to default (not firing when signal comes). When the second SIGCONT comes, nothing will happen. I fixed this. You can try.