Fixed output error code in before/after build commands