task-relative-recur icon indicating copy to clipboard operation
task-relative-recur copied to clipboard

completing task within vit would hang

Open pekcheey opened this issue 3 years ago • 1 comments

I use vit as a frontend to taskwarrior. and it hang while completing tasks with the hook installed. So I made the following workaround.

@@ -62,8 +62,10 @@ if (UDA_DUE in original or UDA_WAIT in original) and original['status']!='comple
                        pass # Thrown because of closing stdout. Don't worry, that's fine.

                # Wait for taskwarrior to finish
-               while (os.path.exists("/proc/%s" % str(task_pid))):
+               sleep_limit = 10 # work around for vit not closing
+               while (os.path.exists("/proc/%s" % str(task_pid)) and sleep_limit > 0):
                        time.sleep(0.25)
+                       sleep_limit -=1

                # Import the follow-up task
                with tempfile.NamedTemporaryFile(mode="wt") as new_task:

I guess task_pid = os.getppid() is reading the ID of the vit process.

it's an ugly hack. but I'm just putting it here for reference for the next better solution. :)

pekcheey avatar Aug 05 '21 11:08 pekcheey

And who doesn't like an ugly hook hack? :-) I've posted it on the taskwarrior discord server under #hooks-and-hacks. https://discord.gg/n4K3zBYJJs Thanks! djp

On Thu, Aug 5, 2021, 7:03 AM pekcheey @.***> wrote:

I use vit as a frontend to taskwarrior. and it hang while completing tasks with the hook installed. So I made the following workaround.

@@ -62,8 +62,10 @@ if (UDA_DUE in original or UDA_WAIT in original) and original['status']!='comple pass # Thrown because of closing stdout. Don't worry, that's fine.

            # Wait for taskwarrior to finish
  •           while (os.path.exists("/proc/%s" % str(task_pid))):
    
  •           sleep_limit = 10 # work around for vit not closing
    
  •           while (os.path.exists("/proc/%s" % str(task_pid)) and sleep_limit > 0):
                      time.sleep(0.25)
    
  •                   sleep_limit -=1
    
              # Import the follow-up task
              with tempfile.NamedTemporaryFile(mode="wt") as new_task:
    

I guess task_pid = os.getppid() is reading the ID of the vit process.

it's an ugly hack. but I'm just putting it here for reference for the next better solution. :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JensErat/task-relative-recur/issues/20, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR6S62ZHAAHPYSYGXSMGV3T3JVYFANCNFSM5BTTUUZA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

linuxcaffe avatar Aug 05 '21 14:08 linuxcaffe