[plug] Xterms and bash and stuff: or, mysterious vanishing windows and mysterious vanishing stdin

Cameron Patrick cameron at patrick.wattle.id.au
Sat Nov 9 13:03:04 WST 2002


Hullo all,

There's something that's often confused me about the way that Linux handles
programs launched in the background.  Most of the time, you can start an X
program in the background by typing something like 'xemacs &' in an xterm,
close the xterm, and the Xemacs will still be there[1].  Occasionally,
though, it disappears in a puff of smoke and nothing is ever heard from it
again. Does anyone know what causes this?

Another curiosity I've noticed with bash's job control is that sometimes, a
backgrounded program will be stopped if it wants to write to the screen,
but other programs won't.  For example, type 'yes &' and you will see a
column of 'y's on your console until the end of its days (more or less)[2];
but if you try something like 'mc &' or 'lynx &', you won't see a thing
until you fg it.

But wait, there's more---some programs (like patch) seem to be able to ask
questions interactively even though their stdin has been redirected to some
other file.  How can does this work if patch doesn't have an open FD to
read from the terminal with?  Magic?

Cheers,

Cameron.

[1] Unless you're one of those heretical VI types who'll see "command not
found" instead.

[2] Is there any way of stopping yes without killing it from another
console?



More information about the plug mailing list