kdheepak / taskwarrior-tui

`taskwarrior-tui`: A terminal user interface for taskwarrior
https://kdheepak.com/taskwarrior-tui
MIT License
1.47k stars 68 forks source link

Zombie `task` processes created #513

Open Matt-Deacalion opened 1 year ago

Matt-Deacalion commented 1 year ago

I have a hook that runs after modifying a task. It has to wait for taskwarrior to exit before it updates the *.data files.

This hook does not work with taskwarrior-tui. This seems to be because taskwarrior-tui spawns task commands that become zombie processes, rather than cleanly exiting.

I can work around this in my hook, but I've noticed a couple of hooks that follow a similar pattern and it would be handy if they worked out-of-the-box with taskwarrior-tui.

kdheepak commented 1 year ago

Why doesn’t that hook work with zombie processes though? Have you tried adding a sleep?

wrt to zombie processes, this was the intended design, but I have been bitten by this as well. I would like to have taskwarrior-tui track all spawned processes and show the user in a UI if there’s still something running in the background. In that case it wouldn’t be a zombie process and the tui will hold a reference to the process that was spawned. That UI could allow users to see the output / terminate the process etc.

Matt-Deacalion commented 1 year ago

Why doesn’t that hook work with zombie processes though? Have you tried adding a sleep?

It used the proc filesystem to determine whether task had stop running; zombies stay in proc. I've fixed this.

wrt to zombie processes, this was the intended design

Ah ok, out of curiosity - why?

I would like to have taskwarrior-tui track all spawned processes and show the user in a UI if there’s still something running in the background.

That would be useful; even if it was just a log of the task commands being run - strace was how I tracked it down.

By the way, thank you for your work on this! My wife and I use it on a daily basis.

kdheepak commented 1 year ago

Ah ok, out of curiosity - why?

One reason was that you may want to run a process like a starting a server, right? Or if someone wanted to run a shortcut that checks for external data every 5 seconds.

Just to clarify, having the ability to run long running process was intended. Using zombie processes was just the easiest way to implement it at the time :)

By the way, thank you for your work on this! My wife and I use it on a daily basis.

It means a lot that people are using it every day and getting value out of it! Some IRL life events have made it difficult to work on it as much as I’d like to have over the last year, but I’m slowly getting back into it.

I have a number of ideas planned, so feel free to open issues that are bugs or feature requests and hopefully I’ll get to them soon!

That would be useful; even if it was just a log of the task commands being run - strace was how I tracked it down.

Oof, that's annoying that that's how you had to track it down. But awesome that you were able to find it. I'm interested in adding a logging view to the UI itself. Here's a gif from another project of mine:

I would like for a similar output for any shell commands and the shortcut commands.

Matt-Deacalion commented 1 year ago

Just to clarify, having the ability to run long running process was intended. Using zombie processes was just the easiest way to implement it at the time :)

Ah I see... waiting on child processes could freeze the UI and forking would leave an orphanage of parent-less processes that outlive the taskwarrior-tui process.

Some IRL life events have made it difficult to work on it as much as I’d like to have over the last year, but I’m slowly getting back into it.

I empathise, I'm transitioning into an old project now... feels like I've stepped into a snake pit.

I'm interested in adding a logging view to the UI itself.

That would be really useful, it's not always clear how task, hooks, shortcuts etc. are interacting with each other.

Thanks again, rare to get such an attentive response! Eager to contribute when I learn rust (it's on my todo list).

kdheepak commented 1 year ago

I’ll keep this issue open to track this request, if that’s okay with you.