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.

Author sfiedler
Recipients
Date 2001-09-13.17:22:15
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
It seems like the function commands.getstatus() should
just return the status of a shell command, rather than
interpreting its argument as a filename and doing an
"ls -ld" on it and returning the output.

I would have thought the function would be implemented
like this (based on commands.getoutput):

def getstatus(cmd):
    """Return exit status of executing cmd in a
shell."""
    return getstatusoutput(cmd)[0]


(Sorry for any line wrapping--the point is just to be
symmetrical with getoutput.)

Note also that closing a pipe can raise an exception,
even if useful output was captured from the command; it
may be convenient to put the pipe.close() in
commands.getstatusoutput() into a try block. But this
is probably an unlikely edge condition in most cases,
and I won't be sad if it doesn't happen :)
History
Date User Action Args
2007-08-23 13:56:22adminlinkissue461280 messages
2007-08-23 13:56:22admincreate