Skip to content

Commit 7132dba

Browse files
committed
Add "isatty" function to StdOutRedirect. Needed by some logging framework
1 parent 3c84463 commit 7132dba

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/PythonQtStdOut.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,21 @@ static PyObject *PythonQtStdOutRedirect_flush(PyObject * /*self*/, PyObject * /*
9191
return Py_BuildValue("");
9292
}
9393

94-
94+
static PyObject *PythonQtStdOutRedirect_isatty(PyObject * /*self*/, PyObject * /*args*/)
95+
{
96+
long res = 0;
97+
return PyBool_FromLong(res);
98+
}
9599

96100
static PyMethodDef PythonQtStdOutRedirect_methods[] = {
97101
{"write", (PyCFunction)PythonQtStdOutRedirect_write, METH_VARARGS,
98102
"redirect the writing to a callback"},
99103
{"flush", (PyCFunction)PythonQtStdOutRedirect_flush, METH_VARARGS,
100104
"flush the output, currently not implemented but needed for logging framework"
101105
},
106+
{"isatty", (PyCFunction)PythonQtStdOutRedirect_isatty, METH_NOARGS,
107+
"return False since this object is not a tty-like device. Needed for logging framework"
108+
},
102109
{NULL, NULL, 0 , NULL} /* sentinel */
103110
};
104111

0 commit comments

Comments
 (0)