sudo?

John Schmitt jschmitt at kealia.com
Fri Mar 7 01:34:57 UTC 2003


I wrote a class that inherited from qm.test.classes.command.ExecTest and
it works the way I expect.

Some of the tests I want to run require that they run as root.  How do I
make ExecTest.RunProgram() pre-pend sudo to my command?  

I was surprised that Executable.Spawn() added some information (absolute
path stuff) to its 'path' variable.  Is that really desired?  Wouldn't
you want to leave that to the test-writer?

Anyway, interactively invoking Python and then execing sudo didn't do
what I thought it would do.  It actually terminates my Python session.
Is that expected?
 
[jschmitt at luai jschmitt]$ python
Python 2.2.2 (#1, Feb 24 2003, 13:44:59) 
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-113)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.execvp( "/usr/bin/sudo", ["ls"] )
usage: sudo -V | -h | -L | -l | -v | -k | -K | [-H] [-P] [-S] [-b] [-p
prompt]
            [-u username/#uid] -s | <command>
[jschmitt at luai jschmitt]$

John




More information about the qmtest mailing list