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

Add support for -on-build= and -on-fail= #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jimstudt
Copy link
Contributor

@jimstudt jimstudt commented Dec 1, 2014

This adds command line options for actions to be executed after successful builds and failed builds.

It lets you ring a terminal bell, or print an attention getting banner on a failed build.

It is also useful if you are working on a service for which you give a "restart" command rather than running it directly. -command does not appreciate commands which exit. For instance, at the moment I'm using

CompileDaemon … -on-build="sudo systemctl restart mydaemonname"

@githubnemo
Copy link
Owner

While -on-fail makes sense, I'm not sure about -on-build since the name suggests the command is executed while building but your description suggests otherwise. What's the problem with -command exactly and can you open a ticket for that?

@jimstudt
Copy link
Contributor Author

In retrospect, -on-build is a terrible name. I intended it to be the action when a build is complete, when there is a successful "build", but that use of "build" came from the verb that means to do the build, so all in all a confusingly ambiguous name. Perhaps -on-success would be better. It nicely mirrors -on-error and captures that it happens at the end.

The reason to have it, is that -command expects and requires that the command keep running and that it is a problem if it stops. This is perfect for running the daemon you have just written. Sometimes though, when the build completes you just want to do a command that terminates. You might use this in conjunction with -command, or all by itself.

Some examples, where names with hyphens are my made up command placeholders. Also notice that you can use shell commands in -on-success and -on-error.

  • -command run-my-daemon -on-success "sleep 1 ; make-my-browser-refresh"
  • -command run-my-daemon -on-success "tput bel #ring bell to alert me"
  • -on-success "systemctl restart my-service-name"

@githubnemo
Copy link
Owner

Sorry for the long wait, I'm quite busy at the moment.

I'm all for -on-error and -on-success. Also it seems practical to invoke the command in a shell but I'm not yet sure if this is the right thing to do. I can easily wrap the command in the shell myself but I cannot undo it when CompileDaemon does that. On the other hand I do not see a reason for not using a shell.

In any way there should be consistent behaviour: in case the on-error command is run in a shell, the -command and -build command should be as well.

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.

None yet

2 participants