>>> import spam
>>> status = spam.system("ls -l")
#include <Python.h>
static PyObject *
spam_system(PyObject *self, PyObject *args)
{
const char *command;
int sts;
if (!PyArg_ParseTuple(args, "s", &command))
return NULL;
sts = system(command);
return Py_BuildValue("i", sts);
}
This also works fine, and maybe I will take this approach, or maybe a bit of both! But I can get this interface to join up and running rather quickly, and I will. Thus delaying any more work on shell.
No comments:
Post a Comment