Opened 13 years ago

Closed 8 years ago

#2755 closed defect (wontfix)

Terminal should warn if applications open before exit

Reported by: greenfeld Owned by: sayamindu
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: Terminal Version: 0.92.x
Severity: Trivial Keywords:
Cc: Distribution/OS: OLPC
Bug Status: Unconfirmed


Although it would seem rather Sugar-unlike (and tends to be rather un-xterm like for most xterms as well), Terminal should warn if applications are open within a Terminal session before exiting.

Otherwise this could lead to data loss, which may confuse kids.


  1. Run "nano" in a Terminal session. Start typing something.
  2. Quit out of the Terminal activity.
  3. Resume the session. The nano data which fit onscreen will sort-of be there, but you will be back at a shell prompt.

Change History (1)

comment:1 Changed 8 years ago by quozl

  • Resolution set to wontfix
  • Status changed from new to closed

When the shell is created, the PID is recorded by Terminal, in, as part of _create_tab.

Terminal may be changed to count all processes with a parent PID equal to the shell PID, and invoke the keep warning if non-zero.

Further refinement may be to check each child process to see if it still has any file descriptors open for the Vte pseudo-terminal in /dev/pts; so that forked background processes do not force a keep warning.

Or, via pkexec and lsof count the number of processes that have the corresponding /dev/pts open.

Unfortunately, there's still a corner case; it is not practical to determine if the shell is at a script prompt if the script was activated with source. So an alternate solution is to require ctrl+d or exit to quit the shell, and block the stop button if the shell process still exists.

As a consequence, there will never be anything to be saved, and so the saving to journal of tab text, theme, and font size can be removed, the journal object could be avoided all together, and Terminal would be much smaller. Yay!

Let the ticket be re-opened when anybody thinks they'd like to have a go at this!

Note: See TracTickets for help on using tickets.