Trouble recovering a suspended process in Linux console version

Create a running sbasic process.

#!/usr/local/bin/sbasic

while true
print “*”;
wend

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

BREAK AT LINE 5 *

^[[30;1R

Hit ENTER again and get this output

barple@penguin:~/sb$ ^[[30;1R
-bash: :s^[[30;1R: substitution failed
barple@penguin:~/sb$

Thank you. I never tested this. I’ll have a look.

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.

I tried everything I could think of and it recovered every time. Hope you are enjoying this as much as I am. :grinning_face:

yes, I enjoy. :slight_smile: The changes are merge now to the master branch. Thanks for the help.