Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to allow background processes to read from stdin

79 views
Skip to first unread message

Selva

unread,
Feb 20, 2012, 5:58:35 PM2/20/12
to
How can we allow background processes to read from stdin?
Is there an equivalent to TOSTOP flag for stdin?

Alan Curry

unread,
Feb 20, 2012, 9:52:53 PM2/20/12
to
In article <1cc041d0-867a-4df6...@db5g2000vbb.googlegroups.com>,
Selva <kobu....@gmail.com> wrote:
>How can we allow background processes to read from stdin?
>Is there an equivalent to TOSTOP flag for stdin?

Nope. Being able to read user input is pretty near the core of what it means
to be in the foreground.

You don't want multiple processes reading the terminal at the same time;
you'd never know which one was getting your next keypress. (Sometimes this
happens anyway, within the context of a single process group. It's always
unpleasant.)

--
Alan Curry

Barry Margolin

unread,
Feb 20, 2012, 11:17:28 PM2/20/12
to
> How can we allow background processes to read from stdin?
> Is there an equivalent to TOSTOP flag for stdin?

Nothing stops background processes from reading from stdin. E.g.

some_command < foo &

will run some_command in the background, reading from the file foo.

I think you meant to ask how to allow background processes to read from
the terminal. I think the only way would be to use a shell without job
control. But as the other response pointed out, this is probably a bad
idea if multiple processes are trying to read from the terminal
simultaneously.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

Bill Marcum

unread,
Feb 21, 2012, 12:44:22 AM2/21/12
to
On 2012-02-20, Selva <kobu....@gmail.com> wrote:
> How can we allow background processes to read from stdin?
> Is there an equivalent to TOSTOP flag for stdin?

If you want to run multiple interactive processes at once, it's best to run
each in its own terminal, such as by using xterm or GNU screen.

--
Why is it that people believe someone who says the world will end in 2012,
but when they see a "wet paint" sign they have to touch it for themselves?
0 new messages