https://github.com/alexito4/trap
It’s a trap! Catch OS signals in Swift. Swift Signal Handler.
https://github.com/alexito4/trap
os signal swift trap
Last synced: about 1 year ago
JSON representation
It’s a trap! Catch OS signals in Swift. Swift Signal Handler.
- Host: GitHub
- URL: https://github.com/alexito4/trap
- Owner: alexito4
- License: mit
- Archived: true
- Created: 2016-05-29T08:47:03.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-06T10:07:05.000Z (over 9 years ago)
- Last Synced: 2025-03-11T08:28:04.315Z (over 1 year ago)
- Topics: os, signal, swift, trap
- Language: Swift
- Size: 7.81 KB
- Stars: 13
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Trap

Trap is a small Swift framework to handle operating system signals.
## Usage
import Trap
let task = NSTask...
Trap.handle(.interrupt) {
task.terminate()
exit(EXIT_FAILURE)
}
task.launch()
It can also handle multiple signals at the same time.
Trap.handle(Trap.Signal.all) {
print("Signal: \($0)")
...
}
## Requirements
Trap is build using the stable version of **Swift 3.0**.