Determining if program executing in shell background?
opengeometry at yahoo.ca
Sat Mar 29 03:30:00 CET 2003
Kevin Perrott <kevin at riversidehonda.com> wrote:
> I'm VERY new to python programming so please be gentle.
> I'm trying to find a function that will tell me if a pyton program is
> executing in the background when launched using the:
> <program name> &
Well, if you are using shell, then
will tell you what you have in the background.
> shell syntax.
> I'm trying to utilize the curses module to output messages to 'windows' and
> the system seems to stop the program when I try to get it to run in the
> background. I'm assuming it has something to do with the curses module
> requiring control of a proper stdout or something along those lines.
> I wrote a small test program using the isatty() function:
> import sys
> import os
> isatty = os.isatty(sys.stdout.fileno())
> if isatty == 1 :
> else :
> that I thought would do the trick but "isatty" always prints whether
> launched by
> <program> &
> I must be missing something somewhere and would appreciate any help you
> guys/gals could give me.
That's because <stdout> has not changed. Only the <stdin>.
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
Linux solution for data management and processing.
More information about the Python-list