Explorar el Código

Remove IPC socket before creation (#1852)

(to make sure that socket path can be created)
Bart hace 3 años
padre
commit
520b3a8f08
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      src/main/java/org/cryptomator/ipc/IpcCommunicator.java

+ 3 - 1
src/main/java/org/cryptomator/ipc/IpcCommunicator.java

@@ -44,7 +44,9 @@ public interface IpcCommunicator extends Closeable {
 		}
 		// Didn't get any connection yet? I.e. we're the first app instance, so let's launch a server:
 		try {
-			return Server.create(socketPaths.iterator().next());
+			final var socketPath = socketPaths.iterator().next();
+			Files.deleteIfExists(socketPath); // ensure path does not exist before creating it
+			return Server.create(socketPath);
 		} catch (IOException e) {
 			LOG.warn("Failed to create IPC server", e);
 			return new LoopbackCommunicator();