Bugs item #891832, was opened at 2004-02-06 14:57
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=891832&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Private: No
Submitted By: Skip Montanaro (montanaro)
Assigned to: Nobody/Anonymous (nobody)
Summary: commands module doesn't support background commands

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2007-03-14 08:34

Message:
Logged In: YES 
user_id=849994
Originator: NO

I think now that the subprocess module is there, it should be used.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=891832&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to