Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bra does not re-execute 'cmd' if new changes appear while 'cmd' was still executing #32

Open
Dieterbe opened this issue Nov 11, 2021 · 1 comment
Labels

Comments

@Dieterbe
Copy link

Hi!
I use bra to essentially run git add -A . && git push in a git repo, any time files are modified, appear, or are deleted in a certain directory

But consider that the following may happen in the directory:

rm a.jpg b.md c.md
rm: remove regular file 'a.jpg'? y
rm: remove regular file 'b.md'? y # after a fraction of a second
rm: remove regular file 'c.md'? y # after another fraction of a second

or

touch foo1.md; sleep 0.5; touch foo2.md

In both of these scenarios, what I observe is that upon the first change, the command is invoked, but as it will run for a few seconds, the subsequent changes are concurrent and are not picked up.
By the time the additional file additions or removals are finished, the command is complete, and the modifications remain in place and are not picked up by bra.

I suggest a change to bra such that if any inotify commands come in while the command is running, the command is run again after it finishes.

@unknwon unknwon added the bug label Nov 11, 2021
@Dieterbe
Copy link
Author

I suggest a change to bra such that if any inotify commands come in while the command is running, the command is run again after it finishes.

After some more thinking, while this would be useful for my use case, i'm not sure if it can be generalized to other bra use cases, or if it's worth an option.

For my use case, i figured out a solution that i'm happy with:
my invoked command will, at the end (e.g. after the git push) just run git status again to see if it needs to do another run, and will keep doing so until git status is empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants