watchbind
watchbind copied to clipboard
Allow executing another command once a background/non-blocking command terminates
I think this would be quite useful for more powerful scripting.
The updated exec &
command could maybe look like:
exec & -- <CMD> ---- <OP>
This design would entail: CMD
is executed non-blockingly, and once it terminates, <OP>
is added to the remaining_operations
. The question would be: if, at that point, the remaining_operations
are not empty, then we have to decided where exactly to add OP
. Should it be executed directly (before all other operations), or only after all queued operations? I would argue it should be appended to the list, because we usually only have a non-empty remaining_operations
when we are currently in a blocking state, where nothing should be allowed to be executed. Therefore, OP
would only be executed once we have an empty remaining_operations
.
We would still have to decide on how to separate exec & -- <CMD>
from <OP>
. Not sure if ----
is ideal there, I think we shouldn't use a simple --
though, as that would be confusing if we e.g. have exec & -- <CMD> -- exec & -- <CMD>". Maybe we should remove
--from
exec & -- <CMD>` entirely, but I really like that syntax for creating separation.