Solved it by turning the rule from a string into a function with the actual execution call wrapped into a try/except block:
def somefunc(task):
# set up the command string using task.inputs, task.outputs [, and task.env]
cmd = 'magicalcommand ' + task.inputs[0].abspath() + ' ' + task.outputs[0].abspath()
try:
return bld.cmd_and_log(cmd)
except Exception as e:
from waflib import Logs
Logs.info('cmd failed!')
return 0
bld(rule=somefunc, source='somefile', target='othersuchfile')
Note that I'm using bld.cmd_and_log
, not bld.exec_command
. The former actually throws on error (and supposedly supplies access to the stdout
and stderr
of the command through e
on failure), the latter just kills the entire build process for me.