首页 > 解决方案 > How to gracefully kill a scons builder when scons is terminated?

问题描述

I've got a long running builder that renders videos. Sometimes during the build I'll notice that it's incorrect and want to kill it, and this requires sending an HTTP request to the render server. Is there some signal or hook in the scons system that I can use to determine when scons is shutting down so that I can send a message to the server?

标签: scons

解决方案


You can do something like this: (original code from SCons manpage) Put this in your SConstruct/SConscript

import atexit

def shutdown_my_server():
    " do your stuff here "
    pass

atexit.register(shutdown_my_server)

推荐阅读