[Reproducer] Surface error if setting the cwd fails

Make sure that we surface an error if setting the current working
directory fails during replay.

llvm-svn: 375146
This commit is contained in:
Jonas Devlieghere 2019-10-17 17:58:44 +00:00
parent e19dfa6745
commit 2b7899b730
1 changed files with 7 additions and 2 deletions

View File

@ -80,8 +80,13 @@ llvm::Error SystemInitializerCommon::Initialize() {
}
if (llvm::Expected<std::string> cwd =
loader->LoadBuffer<WorkingDirectoryProvider>()) {
FileSystem::Instance().GetVirtualFileSystem()->setCurrentWorkingDirectory(
*cwd);
cwd->erase(std::remove_if(cwd->begin(), cwd->end(), std::iscntrl),
cwd->end());
if (std::error_code ec = FileSystem::Instance()
.GetVirtualFileSystem()
->setCurrentWorkingDirectory(*cwd)) {
return llvm::errorCodeToError(ec);
}
} else {
return cwd.takeError();
}