bugGNU Screen - Bugs: bug #48662, Backtick in background does not...


bug #48662: Backtick in background does not exit when screen exits

Submitter:  Amadeusz Sławiński <amade>
Submitted:  Sat 30 Jul 2016 11:32:14 AM UTC
Category:  Program Logic Severity:  3 - Normal
Priority:  * 5 - Normal Status:  Confirmed
Privacy:  Public Assigned to:  None
Open/Closed:  Open Release:  None
Fixed Release:  None Planned Release:  None
Work Required:  None
* Mandatory Fields

Add a New Comment Rich Markup

Fri 01 Oct 2021 10:58:20 AM UTC, comment #1: 

While I agree that I expected screen to send a TERM signal to backtick processes on exit it's not difficult to rewrite this example to die when screen terminates. You just have to write it so the loop terminates once it cannot write output anymore:

bash -c 'while date; do sleep 5; done'

Now date should error if it cannot write to stdout (according to POSIX anyway) and the loop will terminate.

Since the whole point of backtick programs is to write something to display, I would expect that usually this is how they'll work anyway but as said a TERM signal on exit from screen wouldn't hurt.

(Btw, the original example will not die on SIGTERM since it is requesting an interactive login shell for some reason.)

Soliton <soliton>
Sat 30 Jul 2016 11:32:14 AM UTC, original submission:  

On Fri, 29 Jul 2016 17:46:29 -0400
Vincent Newell <vince.newell@gmail.com> wrote:

> (Argh, forsaken by Gmail, sorry.)  Continued:
> I tried on both Ubuntu 14.04.4 updates version (Screen version
> 4.01.00devel (GNU) 2-May-06)
> as well as a fresh clone from master (Screen version 4.99.0 (build on
> Jul 29 2016 17:31:06)
> I was able to reproduce this problem with the following lines in my
> .screenrc
> backtick 1 0 0 bash -ilc "while true ; do sleep 5 ; date ; done"
> hardstatus alwayslastline "%1`"
> Is there any way to make this backtick program exit on screen exit?
> Thanks
> Vince
> On Fri, Jul 29, 2016 at 5:44 PM, Vincent Newell
> <vince.newell@gmail.com> wrote:
> > To whomever's listening -
> >
> > I am trying to create indicator to display a system state string.
> > This string comes from some software following a PUB-SUB
> > architecture.  My first thought was to use backtick to callout
> > periodically to 'poll' the state, but the act of initializing,
> > subscribing, getting a message, and unsubscribing has a lot of
> > overhead.  Since my software already supports PUB-SUB I was hoping
> > backtick supports a background process.  And, just my luck!  It
> > does!
> >
> > "If both the lifespan and the autorefresh parameters are zero, the
> > backtick program is expected to stay in the background and generate
> > output once in a while. In this case, the command is executed right
> > away and screen stores the last line of output. If a new line gets
> > printed screen will automatically refresh the hardstatus or the
> > captions."
> >
> > However, it seems like the background command does not exit when
> > screen exits.
> >
> > I tried on both Ubuntu 14.04.4 updates
> >
> >

Amadeusz Sławiński <amade>
Group administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #38067:  0001-readpipe-TERM-forked-process-on-exit.patch added by vnewell (1KiB - text/x-patch - Really not sure if this is the right way to fix this problem, but maybe it will help someone with a starting point.)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by soliton (Posted a comment)
  • -email is unavailable- added by vnewell (Updated the item)
  • -email is unavailable- added by amade (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-01 vnewell Attached File- Added 0001-readpipe-TERM-forked-process-on-exit.patch, #38067

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code