Ambiguities
Ambiguities

Reputation: 415

c - Ncurses stops process when put in background

Problem:

Ncurses screen initialization causes processes sent to the background to stop and only resume when brought back to the foreground.

Question(s):

Notes:


Any and all help is appreciated.


Status Updates

2013/07/17

Upvotes: 3

Views: 785

Answers (1)

M.E.L.
M.E.L.

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

Related Questions