GetCurrentDir's failure was causing problems with the logic that tries to save the CWD for tests. This solves the problem directly, please advise if there's a more subtle solution.