Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hanjoes/swift-daemon
Daemonize a given routine.
https://github.com/hanjoes/swift-daemon
Last synced: about 2 months ago
JSON representation
Daemonize a given routine.
- Host: GitHub
- URL: https://github.com/hanjoes/swift-daemon
- Owner: hanjoes
- License: mit
- Created: 2019-06-11T04:15:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-13T16:41:25.000Z (over 5 years ago)
- Last Synced: 2024-11-12T15:43:27.196Z (2 months ago)
- Language: Swift
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-inspiration - swift-daemon
README
# SwiftDaemon
Daemonize a given routine.
__"fork"__ is "hidden" from user by Swift, I stole a piece of code from project [Curassow](https://github.com/kylef-archive/Curassow) to re-surface the "fork" system call in Swift.
# Usage
```Swift
import SwiftDaemonSwiftDaemon.daemonize(inDir: "/tmp") {
let fd = fopen("SwiftDaemonTest.log", "w")
defer { fclose(fd) }
for _ in 1...10 {
usleep(1000000)
let content = "Test\n"
fwrite(content, 1, content.count, fd)
fflush(fd)
}
}
```