More build system changes. Windows works (in git bash)
(cherry picked from commit eb429316c76cea7425723762fcc38155b9495d56)
Windows script error handling
(cherry picked from commit e85a01486f6da7b93c8415272f7912fccb7b1feb)