From c0f4eea535384bc6e8ecc70a55fa37e771d08a85 Mon Sep 17 00:00:00 2001 From: Joannis Orlandos Date: Sun, 1 Oct 2023 21:52:57 +0200 Subject: [PATCH] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 210e5ff..961999f 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,13 @@ server.enableExec(withDelegate: MyExecDelegate()) server.enableSFTP(withDelegate: MySFTPDelegate()) ``` +If you're running the SSHServer from `main.swift` or an `@main` annotated type, make sure that Swift doesn't exit or `deinit` the server. +A simple solution that is applicable most of the time is to use the server's `closeFuture`. + +```swift +try await server.closeFuture.get() +``` + ### Exec Server When creating a command execution delegate, simply implement the `ExecDelegate` protocol and the following functions: