From cd59da455e237609fdaf5cf218b79dd1e2256120 Mon Sep 17 00:00:00 2001 From: BrenBarn Date: Thu, 13 Oct 2016 11:39:58 -0700 Subject: [PATCH] Added "manual override" to get DreamPie out of its stuck state. The problem seems to be due to the _n_unclaimed_results counter somehow getting out of sync. At some point, this counter is incremeneted but not properly decremented. The result is that DreamPie keeps saying "subprocess is busy", thinking it is waiting for a result, but there really isn't any result coming, so it waits forever. (This waiting occurs in DreamPie.call_subp_noblock, which is called from execute_source.) The "solution" is to add a simple method to the DreamPie class that just decrements _n_unclaimed_results. I then added a menu item to call this function. If this "stuck" situation arises, you can clear it by using this manual override. Note that using this when the subprocess is *not* stuck could cause havoc, so be careful! --- dreampielib/data/dreampie.glade | 11 +++++++++++ dreampielib/gui/__init__.py | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/dreampielib/data/dreampie.glade b/dreampielib/data/dreampie.glade index d15cd81..30cfd92 100644 --- a/dreampielib/data/dreampie.glade +++ b/dreampielib/data/dreampie.glade @@ -1982,6 +1982,17 @@ You can also set the __expects_str__ attribute of a function to True to achieve + + + True + False + Try to unclog a stuck subprocess. Use with care! + False + Unclog subprocess + True + + + True diff --git a/dreampielib/gui/__init__.py b/dreampielib/gui/__init__.py index 639f82e..c71fefc 100644 --- a/dreampielib/gui/__init__.py +++ b/dreampielib/gui/__init__.py @@ -964,6 +964,16 @@ def on_interrupt(self, _widget): _("A command isn't being executed currently")) beep() + def on_unclog_subprocess(self, _widget): + # It seems that sometimes DreamPie thinks there is an unclaimed + # result when there really isn't. Here we try to clear the clog by + # decrementing the unclaimed result counter. This could blow up + # badly if used at the wrong time, so should only be used when it + # really seems like DreamPie thinks the subprocess is busy but it + # really isn't. + self._n_unclaimed_results -= 1 + + # History persistence def on_save_history(self, _widget):