- Catch exceptions in initialization

- Show unmount command after successfully mounted
This commit is contained in:
Sebastian Messmer 2015-10-30 20:32:25 +01:00
parent 030adc4b89
commit 057113df00

View File

@ -29,6 +29,7 @@
using namespace cryfs;
namespace bf = boost::filesystem;
using namespace cpputils::logging;
using blockstore::ondisk::OnDiskBlockStore;
using blockstore::inmemory::InMemoryBlockStore;
@ -116,6 +117,7 @@ namespace cryfs {
}
void Cli::_runFilesystem(const ProgramOptions &options) {
try {
auto blockStore = make_unique_ref<OnDiskBlockStore>(bf::path(options.baseDir()));
auto config = _loadOrCreateConfig(options);
CryDevice device(std::move(config), std::move(blockStore));
@ -123,11 +125,18 @@ namespace cryfs {
fspp::fuse::Fuse fuse(&fsimpl);
_initLogfile(options);
std::cout << "\nFilesystem is running. To unmount, call:\n$ fusermount -u " << options.mountDir() << "\n" << std::endl;
_goToBackgroundIfSpecified(options);
vector<char *> fuseOptions = options.fuseOptions();
std::cout << "\nFilesystem is running." << std::endl;
fuse.run(fuseOptions.size(), fuseOptions.data());
} catch (const std::exception &e) {
LOG(ERROR) << "Crashed: " << e.what();
} catch (...) {
LOG(ERROR) << "Crashed";
}
}
void Cli::_goToBackgroundIfSpecified(const ProgramOptions &options) {