forked from mirrors/kore
Add kore.proc.pid, returns the PID of the proc.
This commit is contained in:
parent
ec249390b1
commit
bc33a5def4
|
@ -539,10 +539,18 @@ static PyMethodDef pyproc_methods[] = {
|
|||
METHOD(NULL, NULL, -1),
|
||||
};
|
||||
|
||||
static PyObject *pyproc_get_pid(struct pyproc *, void *);
|
||||
|
||||
static PyGetSetDef pyproc_getset[] = {
|
||||
GETTER("pid", pyproc_get_pid),
|
||||
GETTER(NULL, NULL),
|
||||
};
|
||||
|
||||
static PyTypeObject pyproc_type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "kore.proc",
|
||||
.tp_doc = "async process",
|
||||
.tp_getset = pyproc_getset,
|
||||
.tp_methods = pyproc_methods,
|
||||
.tp_basicsize = sizeof(struct pyproc),
|
||||
.tp_dealloc = (destructor)pyproc_dealloc,
|
||||
|
|
|
@ -3690,6 +3690,12 @@ pyproc_close_stdin(struct pyproc *proc, PyObject *args)
|
|||
Py_RETURN_TRUE;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
pyproc_get_pid(struct pyproc *proc, void *closure)
|
||||
{
|
||||
return (PyLong_FromLong(proc->pid));
|
||||
}
|
||||
|
||||
static void
|
||||
pyproc_op_dealloc(struct pyproc_op *op)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue