Add support for -on-build= and -on-fail=
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"
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?
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"
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.