Ensure replacing environment does not crash toolset if there are bash errors