Reputation: 415
Ncurses screen initialization causes processes sent to the background to stop and only resume when brought back to the foreground.
Any and all help is appreciated.
2013/07/17
Looking through ncurses documentation for a reason that initscr() cause program interruption when sent to background.
Looking into detection of process state.
Upvotes: 3
Views: 785
Reputation: 613
I think the culprits might be (from signal(7))
SIGTTIN 21,21,26 Stop tty input for background process
SIGTTOU 22,22,27 Stop tty output for background process
I don't know if one can override signal handling for these signals while using ncurses. It doesn't seem to make much sense, though: Neither do you want to steal input from the foreground process, nor do you want to scribble on the tty in an uncontrolled fashion (destroying whatever the foreground process wrote). So I think, the behaviour you observe, might be the only sensible ...
But: If you want to run some ncurses program in background, you could use screen http://www.gnu.org/software/screen/ which is in almost any Linux distribution. Run you're process in a detached screen, then reconnect with 'screen -r -D' or similar.
Upvotes: 1