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

Return failure code to the system when commands fail #75

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

nicoddemus
Copy link
Collaborator

Currently mu will always return 0 to the system even when the git commands have failed.

While it is definitely good to always try the operations in all repositories (instead of stopping at the first error), always returning 0 to the system makes using 'mu' in scripts difficult, as we cannot easily be sure that the operations were successful.

In addition, this will now print (in red) the repositories where the operation has failed: a very common beginner mistake when using mu is to not notice that the command failed for one of the repositories, as it may end up at the top of the output.

Here is a screenshot of mu checkout foobar where only ben10 has that branch:

image

Currently mu will always return 0 to the system even when the git commands have failed.

While it is definitely good to always try the operations in all repositories (instead of stopping at the first error), always returning 0 to the system makes using 'mu' in scripts difficult, as we cannot easily be sure that the operations were successful.

In addition, this will now print (in red) the repositories where the operation has failed: a very common beginner mistake when using `mu` is to not notice that the command failed for one of the repositories, as it may end up at the top of the output.
@fabioz fabioz merged commit 0d23dee into fabioz:master Feb 8, 2024
1 of 2 checks passed
@fabioz
Copy link
Owner

fabioz commented Feb 8, 2024

Dae Bruno, tudo certo por ai? Valeu pelo PR :)

@nicoddemus
Copy link
Collaborator Author

Tudo certo Zaza! E contigo cara?

O teste no linux falhou, eu tava vendo agora... quer que eu abra um follow up corrigindo ele?

@fabioz
Copy link
Owner

fabioz commented Feb 8, 2024

Tudo certo :)

Se vc quiser ajuda (nada a ver com este PR).

@fabioz
Copy link
Owner

fabioz commented Feb 8, 2024

Eu mudei o diff para usar o beyond compare por default (bem melhor que o meld...).

@fabioz
Copy link
Owner

fabioz commented Feb 8, 2024

Ops, na verdade tinha 2 falhas... heheh. Valeu, ja fiz o merge.

@jbrwilkinson
Copy link

Thanks @nicoddemus this is an excellent addition. For the final sys.exit, do you think it is worth returning the total number of failures, rather than 1 (some number failed) or 0 (everything succeeded)?

@nicoddemus
Copy link
Collaborator Author

For the final sys.exit, do you think it is worth returning the total number of failures, rather than 1 (some number failed) or 0 (everything succeeded)?

I don't have the need for that, but I can see it being useful yes. Feel free to open a follow-up PR changing that. 👍

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

Successfully merging this pull request may close these issues.

3 participants