all repos — openbox @ 93ea4c4d2ea2b1ff3dfee40fb114f3080001e4ce

openbox fork - make it a bit more like ryudo

supply more information about errors when running scripts
Dana Jansens danakj@orodu.net
commit

93ea4c4d2ea2b1ff3dfee40fb114f3080001e4ce

parent

16a952c35dd15d52b304abaf9c366e9263b45430

2 files changed, 5 insertions(+), 4 deletions(-)

jump to
M src/python.ccsrc/python.cc

@@ -35,12 +35,12 @@ {

Py_Finalize(); } -bool python_exec(const std::string &path) +int python_exec(const std::string &path) { FILE *rcpyfd = fopen(path.c_str(), "r"); if (!rcpyfd) { fprintf(stderr, _("Unabled to open python file %s\n"), path.c_str()); - return false; + return 1; } //PyRun_SimpleFile(rcpyfd, const_cast<char*>(path.c_str()));

@@ -51,7 +51,7 @@ PyObject *dict = PyModule_GetDict(module);

assert(dict); PyObject *result = PyRun_File(rcpyfd, const_cast<char*>(path.c_str()), Py_file_input, dict, dict); - bool ret = result != NULL; + int ret = result == NULL ? 2 : 0; if (result == NULL) PyErr_Print();
M src/python.hhsrc/python.hh

@@ -231,7 +231,8 @@ #ifndef SWIG

void python_init(char *argv0); void python_destroy(); -bool python_exec(const std::string &path); +//! Returns 0 for success, 1 for failing to open the file, 2 for an exception +int python_exec(const std::string &path); #endif // SWIG