Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/main/java/org/cryptomator/cli/CryptomatorCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,18 @@ private static Optional<WebDav> initWebDavServer(Args args) {
private static void waitForShutdown(Runnable runnable) {
Runtime.getRuntime().addShutdownHook(new Thread(runnable));
LOG.info("Press Ctrl+C to terminate.");

// Block the main thread infinitely as otherwise when using
// Fuse mounts the application quits immediately.
try {
while (true) {
System.in.read();
Object mainThreadBlockLock = new Object();
synchronized (mainThreadBlockLock) {
while (true) {
mainThreadBlockLock.wait();
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
LOG.error("Main thread blocking failed.");
}
}
}