I want to make Waf generate a beep when it finishes the execution of any command that took more than 10 seconds.
I don’t know how do add this and assure that the code executes when Waf exits.
This should run for any Waf command not only build.
I checked the Waf book but I wasn’t able to find any indication about how should I do this.
In your
wscriptmodule, you can use the Python standard library’s atexit to register callables that you want to be called when the process exit. For example:Of course you may use something better than
print '\7'for beeping purposes (all the way to full-fledged multimedia extravaganzas, depending on what other Python extensions you import and use), but this code answers the Q’s title — “add code that’s always executed on exit”.