This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: commands module doesn't support background commands
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, skip.montanaro
Priority: normal Keywords:

Created on 2004-02-06 14:57 by skip.montanaro, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg19931 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2004-02-06 14:57
The structure of the command passed to os.popen()
prevents the getoutput() and getstatusoutput() functions
from accepting commands for background
execution.  I think it would be sufficient to see if the
last non-whitespace character in the command was '&'
and if so, suppress insertion of the semicolon into the
command passed to os.popen():

  dosemi = not cmd.strip()[-1:] == '&'
  pipe = os.popen('{ %s%s } 2>&1' %
                         (cmd, dosemi and ';' or ''), 'r')

The above is untested, but based on my fiddling at the
shell prompt seems to be what's called for.

Since the status and output mean little or nothing
when the command is executed in the background,
perhaps a better alternative would be to add a new
function to the module which doesn't return either,
but dumps stdout and stderr to /dev/null.
msg19932 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-14 08:34
I think now that the subprocess module is there, it should be used.
History
Date User Action Args
2022-04-11 14:56:02adminsetgithub: 39907
2004-02-06 14:57:05skip.montanarocreate